AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Opengl animation example car8/30/2023 ![]() 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. The cube is made of of 6 quads, each having different colors. 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
Read More
Leave a Reply. |