第一个简单的OpenGL程序
#include<stdio.h>
#include<glut.h>
void display()
{
glClearColor(0.0,0.0,0.0,0.0);
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 main(int argc,char **argv )
{
glutInit(&argc, argv);
glutInitWindowPosition(100, 100);
glutInitWindowSize(500, 500);
glutCreateWindow("test");
glutDisplayFunc(display);
glutMainLoop();
}