vs2013下OpenGL環境的配置
1、下載glut庫:https://files.cnblogs.com/files/laoxia/glutdlls37beta.zip
2、解壓後,將glut.lib和glut32.lib兩個文件拷貝到X:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\lib 目錄下;
3、將文件glut.dll 和 glut32.dll拷貝到C:\Windows\system32文件夾內(32位系統)或?C:\Windows\SysWOW64(64位系統)下;
4、將頭文件 glut.h 拷貝到 X:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\GL 下;
5、編寫Demo並編譯運行:
#include <GL/glut.h>
#include <stdlib.h>
void display(void)
{
glColor3f (1.0, 1.0, 1.0);
glBegin(GL_POLYGON);
glVertex3f (0.25, 0.25, 0.0);
glVertex3f (0.75, 0.25, 0.0);
glVertex3f (0.75, 0.75, 0.0);
glVertex3f (0.25, 0.75, 0.0);
glEnd();
glFlush ();
}
void init (void)
{
glClearColor (0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(0.0, 1.0, 0.0, 1.0, -1.0, 1.0);
}
int main(int argc, char** argv)
{
glutInit(&argc, argv);
glutInitDisplayMode (GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize (250, 250);
glutInitWindowPosition (100, 100);
glutCreateWindow ("hello");
init ();
glutDisplayFunc(display);
glutMainLoop();
return 0;
}
vs2013下OpenGL環境的配置