VS2017安装openGL

项目名->管理NuGet程序包->浏览->搜索nupengl,下载安装即可。
参考博客:https://blog.csdn.net/HY_JT/article/details/79482556
还可以参考博客:https://blog.csdn.net/yinglang19941010/article/details/50166343

#include 
#include 
#include 

#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;
}

运行结果:
VS2017安装openGL_第1张图片

你可能感兴趣的:(VS2017安装openGL)