The simplest course of configuring OpenGL in vs2015

This may be the simplest configuration of OpenGL related library method, this semester needs to learn graphics, so the Internet to find a variety of configuration OpenGL method, found that many people are copied to copy, many methods are wrong. Otherwise, the PC environment is different and various.lib file lookup errors appear in the configuration. Also many methods need to configure the external environment, is also troublesome. Today I will introduce my own method, do not need to consider the computer environment, convenient and simple.
1. Upgrade to VS2015
I am using VS2015. I do not know about the previous version, nor do I know whether it can be used, so I suggest you to upgrade to 2015. After all, do you use the new version or not?
2. Open VS2015 and create a new Win32 project (won’t create the wall to go).
Name it whatever you want, place it whatever you want.
3. Use NUTGET
This step is the most important and the only step in the configuration process.
vs2015 toolbars -> NuGet Package Manager-> Manage Nuget Packages for solution
The diagram below

And then you see something like this

Search the Browse window for any library you want. For example, here I want to configure glew and freeGLUT, I’ll search glew and then click Install at the top.
When configuring FreeGLUT, remember to select the second one. In fact, you can look at the installation amount, and select the one with the highest installation amount as the safest install.
4. Test

#include <stdio.h>
#include <GL/glew.h>
#include <GL/glut.h>
void init()
{
    glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
}

void display()
{
    glClear(GL_COLOR_BUFFER_BIT);
}

int main(int argc, char* argv[])
{
    glutInit(&argc, argv);
    glutInitWindowPosition(100, 100);
    glutInitWindowSize(800, 480);
    glutInitDisplayMode(GLUT_RGBA);

    glutCreateWindow("opengl");

    glewInit();

    init();

    glutDisplayFunc(display);

    glutMainLoop();
    return 0;
}

Run this code, if run successfully indicates that the configuration is successful, do not need any reference code what, super convenient!!
if you’re running failure is your problem, it’s ok with me (low ˇ ∀ ˇ “)


Read More: