| |||||||||||
|
Main Menu Other |
Tutorials -- Drawing Triangles | ||||||||||
|
The CodeLets start with the code that sets up our matrices. glMatrixMode(GL_PROJECTION); glLoadIdentity(); gluPerspective(45, (GLfloat) ww/(GLfloat) wh, 1, 700); glMatrixMode(GL_MODELVIEW); glLoadIdentity(); glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); This code first sets the matrixmode to GL_PROJECTION. Then it resets it to zero (LoadIdentity()) and sets up our perspective. This makes OpenGL render at a 45 degree viewing angle, and makes things look right depending on our window with and height (the ww and wh variables). The last 2 parameters set our near and far "clipping planes". These determine how far we can see in the 3d world. After that, it sets us back to the MODELVIEW matrix and sets it to zero also. Finally, it clears our color buffer and depth buffer. Basically it sets everything back to zero again.
|
|||||||||||