OpenGL commands are buffered and do not necessarily execute immediately. Calling glFlush will indicate that you want to wait until all buffered commands are finished executing before allowing your program to continue. Note that calling it is not usually necessary and will cause a performance hit.
glMatrixMode(GL_PROJECTION); //what are the Flags for this?
glLoadIndentity(); |
glMatrixMode and glLoadIdentity are both deprecated functions (ie: if you want to program modern OpenGL, you shouldn't be using them. Read the arcsythesis tutorial for a guide on how to do this the modern way:
http://www.arcsynthesis.org/gltut/ )
In older versions of OpenGL, there were several matrixes which transformed input verteces to allow you to scale models/move the camera/apply depth/etc/etc.
The two "main" matrixes were the modelview matrix (GL_MODELVIEW) and the projection matrix (GL_PROJECTION). There are others... for a list you can look at glMatrixMode documentation:
http://www.opengl.org/sdk/docs/man2/xhtml/glMatrixMode.xml
The model view translates vertex positions from Model Space to Camera Space.
The projection matrix translates vertex positions from Camera Space to Clip Space.
IE: model view is for moving meshes around/rotating/etc, and for positioning the camera. Projection is for taking what's in view of the camera and putting it on screen.
By Calling glMatrixMode, you are specifying which matrix you want future matrix operations to modify.
glLoadIdentity is a matrix operation which loads the current matrix (specified by the last call to glMatrixMode) with an identity matrix. Identity matrix do no transformations (ie: the vertex you pass in is the same vertex that gets passed out).
and what do i need for Perspective? |
If whatever tutorial you're using does not explain how to do perspective... I highly recommend you ditch it and use a tutorial that does.
In fact... since you're learning outdated OpenGL, I highly recommend you ditch your tutorial anyway and use a more modern one like the arcsythesis one I linked above.