![]() ![]() GlEnd() // End of drawing color-cube // Render a pyramid consists of 4 triangles GlBegin(GL_QUADS) // Begin drawing the color cube with 6 quads // Top face (y = 1.0f) // Define vertices in counter-clockwise (CCW) order with normal pointing out GlTranslatef(1.5f, 0.0f, -7.0f) // Move right and into the screen GlLoadIdentity() // Reset the model-view matrix ![]() GlMatrixMode(GL_MODELVIEW) // To operate on model-view matrix // Render a color-cube consisting of 6 quads with different colors GlClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT) // Clear color and depth buffers Whenever the window needs to be re-painted. Called back when the window first appears and GlHint(GL_PERSPECTIVE_CORRECTION_HINT, GL_NICEST) // Nice perspective corrections GlShadeModel(GL_SMOOTH) // Enable smooth shading GlDepthFunc(GL_LEQUAL) // Set the type of depth-test GlEnable(GL_DEPTH_TEST) // Enable depth testing for z-culling GlClearDepth(1.0f) // Set background depth to farthest ![]() GlClearColor(0.0f, 0.0f, 0.0f, 1.0f) // Set background color to black and opaque #include // GLUT, include glu.h and gl.h /* Global variables */ The hallow pyramid is made up of 4 triangle, with different colors on each of the vertices. Exam Style Questions - A collection of GCSE style problems related to the statement: 'Pupils should be taught to construct and interpret plans and elevations of 3D shapes'. Level 6 - Draw all the different ways that four cubes could be arranged. The cube is made of of 6 quads, each having different colors. Level 5 - Draw a two-dimensional representation of a model after one cube has been added. This example is taken from Nehe OpenGL Tutorial Lesson # 5 ), which displays a 3D color-cube and a pyramid. Otherwise, read " Introduction to OpenGL with 2D Graphics". I assume that you have some knowledge of OpenGL. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |