OpenGL教程之创建一个glut窗口
环境配置
ArchLinux:
yaourt freeglut
安装freeglut。
代码如下
#include <GL/gl.h>
#include <GL/freeglut.h>
void Display(void)
{
glClear(GL_COLOR_BUFFER_BIT
|GL_DEPTH_BUFFER_BIT
|GL_STENCIL_BUFFER_BIT
);
glutWireTeapot(0.5);
glutSwapBuffers();
}
int main(int argc
,char **argv
)
{
glutInit(&argc
,argv
);
glutInitDisplayMode(GLUT_DOUBLE
| GLUT_RGBA
| GLUT_DEPTH
);
glutInitWindowSize(640, 480);
glutInitWindowPosition(100, 100);
glutCreateWindow("Demo");
glutDisplayFunc(Display
);
glutMainLoop();
return 0;
}
运行后结果如下:
转载请注明原文地址: https://win8.8miu.com/read-1452797.html