#include <GL/glut.h>
#include <stdlib.h>
void display();
void init();
void display()
{
glClear(GL_COLOR_BUFFER_BIT);
glMatrixMode(GL_MODELVIEW);
glColor3f(1.0,0.0,0.0);
glPushMatrix();
glutWireCube(1.0);
glPopMatrix();
glutSwapBuffers();
glFlush();
}
//init the window
void init()
{
glClearColor(1.0,1.0,1.0,1.0);
glColor3f(0.0,0.0,0.0);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glOrtho(1.0,1.0,0.0,1.0,-1.0,1.0);
}
//the program starts here
int main(int argc,char** argv)
{
glutInit(&argc,argv);
glutInitDisplayMode(GLUT_SINGLE | GLUT_RGB);
glutInitWindowSize(500,500);
glutInitWindowPosition(0,0);
glutCreateWindow("cube");
init();
glutDisplayFunc(display);
glutMainLoop();
}
蛊毒传说
繁星点点滴滴