转自NeHe教程
public override void Draw() { // Here's Where We Do All The Drawing glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); // Clear Screen And Depth Buffer glLoadIdentity(); // Reset The Current Modelview Matrix glTranslatef(0.0f, 0.0f, -6.0f); // Move Into The Screen 6.0 glRotatef(angle, 0.0f, 1.0f, 0.0f); // Rotate The Triangle On The Y Axis By angle for(rot1 = 0; rot1 < 2; rot1++) { // 2 Passes For Two Sets Of Triangles glRotatef( 90.0f, 0.0f, 1.0f, 0.0f); // Rotate 90 Degrees On The Y-Axis glRotatef(180.0f, 1.0f, 0.0f, 0.0f); // Rotate 180 Degress On The X-Axis for(rot2 = 0; rot2 < 2; rot2++) { // 2 Passes For Each Of The Sets, Draw Two Triangles glRotatef(180.0f, 0.0f, 1.0f, 0.0f); // Rotate 180 Degrees On The Y-Axis glBegin(GL_TRIANGLES); // Begin Drawing Triangles glColor3f(1.0f, 0.0f, 0.0f); glVertex3f( 0.0f, 1.0f, 0.0f); // Draw The Red Vertex glColor3f(0.0f, 1.0f, 0.0f); glVertex3f(-1.0f, -1.0f, 1.0f); // Draw The Green Vertex glColor3f(0.0f, 0.0f, 1.0f); glVertex3f( 1.0f, -1.0f, 1.0f); // Draw The Blue Vertex glEnd (); // Done Drawing Triangles } } angle += 0.2f; // Update angle glFlush(); // Flush The GL Rendering Pipeline }