OpenGL what r these functions doing ???

I got really confused about OGL so ...
what are these Functions doing ...?

glFlush();
glOrtho();
glFrustum();
glMatrixMode(GL_PROJECTION); //what are the Flags for this?
glLoadIndentity();

and what do i need for Perspective?
thx guys :D

Last edited on
glFlush();


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.
thx .. but in what situation do i glFlush() need?
what is a Matrix ..?
Because any GL program might be executed over a network, or on an accelerator that buffers commands, all programs should call glFlush whenever they count on having all of their previously issued commands completed. For example, call glFlush before waiting for user input that depends on the generated image.


From the OpenGL documentation on glFlush:
http://www.opengl.org/sdk/docs/man/xhtml/glFlush.xml
thx
what is a Matrix ..?


You are diving in over your head.

Read the arcsythesis tutorial. It explains all of this. It's very beginner friendly.

http://www.arcsynthesis.org/gltut/

Don't skip ahead. Read every section.
ok
Topic archived. No new replies allowed.