OpenGL Open Graphics Library#
VS2010(Win7 32位系统)配置OpenGL方法:
- glut下载
- glut库配置:
- glut.h ——————-> C:\Program Files(x86)\Microsoft SDKs\Windows\v7.0A\Include\gl
- glut.dll,glut32.dll ——> C:\Windows\System32(x86) /C:\Windows\System64(x64)
- glut.lib,glut32.lib —- -> ***Microsoft Visual Studio 10.0\VC\lib
-
测试代码:
#include <gl\glut.h>
void myDisplay(void)
{
glClear(GL_COLOR_BUFFER_BIT);
glRectf(-0.5f, -0.5f, 0.5f, 0.5f);
glFlush();
}
int main(int argc, char *argv[])
{
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(100, 100);
glutInitWindowSize(400, 400);
glutCreateWindow(“Hello,OpenGL!”);
glutDisplayFunc(&myDisplay);
glutMainLoop();
return 0;
} -
结果: