http://jingyan.baidu.com/article/c74d60007d104f0f6b595d6d.html
样例程序:
#include <GL/glut.h> #include <stdlib.h> void init(); void display(); int main(int argc, char* argv[]) {
glutInit(&argc, argv);
glutInitDisplayMode(GLUT_RGB | GLUT_SINGLE);
glutInitWindowPosition(, );
glutInitWindowSize(, );
glutCreateWindow("OpenGL 3D View");
init();
glutDisplayFunc(display);
glutMainLoop();
return ;
} void init()
{
glClearColor(0.0, 0.0, 0.0, 0.0);
glMatrixMode(GL_PROJECTION);
glOrtho(-, , -, , , );
glMatrixMode(GL_MODELVIEW);
gluLookAt(, , , , , , , , );
} void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glColor3f(1.0, , );
glutWireTeapot();
glFlush();
}
效果:
注:项目开发
开发的时候,新建GLUT工程,在main.cpp里面编写代码即可
新建后,自带有一个openGL的例子