2、glaux.h>HDChDC=NULL;HGLRChRC=NULL;HWNDhWnd=NULL;HINSTANCEhInstance;BOOLkeys[256];BOOLactive=TRUE;BOOLfullscreen=TRUE;GLfloatrtri;GLfloatrquad;LRESULTCALLBACKWndProc(HWND,UINT,WPARAM,LPARAM);GLvoidResizeGLScene(GLsizeiwidth,GLsizeiheight){if(height==0)height=1;glViewport(0,0,width,height);
3、glMatrixMode(GL_PROJECTION);glLoadIdentity();gluPerspective(45.0f,(GLfloat)width/(GLfloat)height,0.1f,100.0f);glMatrixMode(GL_MODELVIEW);glLoadIdentity();}intInitGL(GLvoid){glShadeModel(GL_SMOOTH);glClearColor(0.0f,0.0f,0.0f,0.5f);glClearDepth(1.0f);glEnable(GL_DEPTH_TEST);glDepthFunc(GL_
4、LEQUAL);glHint(GL_PERSPECTIVE_CORRECTION_HINT,GL_NICEST);returnTRUE;}intDrawGLScene(GLvoid){glClear(GL_COLOR_BUFFER_BIT
5、GL_DEPTH_BUFFER_BIT);glLoadIdentity();glTranslatef(-1.5f,0.0f,-6.0f);glRotatef(rtri,0.0f,1.0f,0.0f);glBegin(GL_TRIANGLES);glColor3f(1.0f,0.0f,0.0f);glVertex3f(0.0f,1.0f,
6、0.0f);glColor3f(0.0f,1.0f,0.0f);glVertex3f(-1.0f,-1.0f,1.0f);glColor3f(0.0f,0.0f,1.0f);glVertex3f(1.0f,-1.0f,1.0f);glColor3f(1.0f,0.0f,0.0f);glVertex3f(0.0f,1.0f,0.0f);glColor3f(0.0f,0.0f,1.0f);glVertex3f(1.0f,-1.0f,1.0f);glColor3f(0.0f,1.0f,0.0f);glVertex3f(1.0f,-1.0f,-1.0f);glColor3f(1.
7、0f,0.0f,0.0f);glVertex3f(0.0f,1.0f,0.0f);glColor3f(0.0f,1.0f,0.0f);glVertex3f(1.0f,-1.0f,-1.0f);glColor3f(0.0f,0.0f,1.0f);glVertex3f(-1.0f,-1.0f,-1.0f);glColor3f(1.0f,0.0f,0.0f);glVertex3f(0.0f,1.0f,0.0f);glColor3f(0.0f,0.0f,1.0f);glVertex3f(-1.0f,-1.0f,-1.0f);glColor3f(0.0f,1.0f,0.0f);gl
8、Vertex3f(-1.0f,-1.0f,1.0f);glEnd();glLoadIdentity();glTranslatef(1.5f,0.0f,-7.0f);glRotatef(rquad,1.0f,1.0f,1.0f);glBegin(GL_QUADS);glColor3f(0.0f,1.0f,0.0f);glVertex3f(1.0f,1.0f,-1.0f);glVertex3f(-1.0f,1.0f,-1.0f);glVertex3f(-1.0f,1.0f,1.0f);glVertex3f(1.0f,1.0f,1.