部分代码: // FScreen.c // OpenGL SuperBible, Chapter 17 // Program by Richard S. Wright Jr. // This program shows a how to create a full screen // window and render into it with OpenGL. #include #include #include #include #include #include #includ
立方体旋转程序 /* Rotating cube with color interpolation */ /* Demonstration of use of homogeneous coordinate transformations and simple data structure for representing cube from Chapter 4 */ /* Colors are assigned to the vertices */ /* cube is centered at
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); glLoadIdentity(); glTranslatef(.0f, .0f, -10.0f); glRotatef(rot,1.0f,0.0f,0.0f); // Rotate On The X Axis glRotatef(rot*1.5f,0.0f,1.0f,0.0f); // Rotate On The Y Axis glRotatef(rot*1.4f,0.0f,0.0f,1.0