#include <GL/glut.h>
void display();
void init();
int main(int argc, char ** argv)
{
glutInit(&argc, argv);
glutCreateWindow("simple");
glutDisplayFunc(display);
init();
glutMainLoop();
}
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();
}
void init()
{
glClearColor(0.0,0.0,0.0,0.0);
}
画一个白色的矩形
最新推荐文章于 2024-09-11 14:46:56 发布