OpenGL(2) glut库测试

来源:互联网 发布:java生成嵌套json数据 编辑:程序博客网 时间:2024/05/29 18:13

下载glut :http://www.opengl.org/resources/libraries/glut/

配置方法:

1、将glut.h添加到 C:\Program Files\Microsoft SDKs\Windows\v6.0A\Include\gl 中

2、将 glut.lib 和 glut32.lib 添加到 C:\Program Files\Microsoft Visual Studio 9.0\VC\lib 中

3、将 glut.dll 和 glut32.dll 添加到 C:\Windows\System32 中

测试:

// opengl12.cpp : Defines the entry point for the console application.//#include "stdafx.h"#include "gl/glut.h"void display(){glClear(GL_COLOR_BUFFER_BIT);glBegin(GL_POLYGON);glVertex2f(-0.5,-0.5);glVertex2f(-0.5,0.5);glVertex2f(0.5,0.5);glVertex2f(0.5,-0.5);glEnd();glFlush();}int _tmain(int argc, char** argv){glutInit(&argc,argv);glutCreateWindow("Hello,world!");glutDisplayFunc(display);glutMainLoop();return 0;}
配置:



结果:




0 0