Vs2017 installing OpenGL

The project name – & gt; Manage NUGET packages ->; Browse – & gt; Search Nupengl, download and install it. Reference blog:

https://blog.csdn.net/HY_JT/article/details/79482556 can also refer to the blog: https://blog.csdn.net/yinglang19941010/article/details/50166343

#include <cstdio>
#include <GL/glew.h>
#include <GL/freeglut.h>

#pragma comment(lib, "glew32.lib")

void displayFunction()
{
	glClear(GL_COLOR_BUFFER_BIT);
	glRectf(-0.5, -0.5, 0.5, 0.5);
	glColor3f(0.0, 1.0, 0.0);
	glFlush();
};

int main(int argc, char *argv[])
{
	glutInit(&argc, argv);
	glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
	glutInitWindowSize(600, 600);
	glutCreateWindow("The first OpenGL Application");

	glewExperimental = true;
	glewInit();

	printf("OpenGL version: (%s) \n", glGetString(GL_VERSION));
	glutDisplayFunc(&displayFunction);
	glutMainLoop();

	return 0;
}

Read More: