PDA

View Full Version : I am new in GL. I can not understand MatrixMode



ebekir
11-11-2008, 12:02 AM
Hi,
I am new in OpenGL. I tyr to write code in OpenGL so I examine sample codes. while examinig I can not understand What glMatrixMode does and How MatrixMode works. what is the difference GL_PROJECTION and GL_MODELVIEW . in the below jogl code ,why the first GL_PROJECTION, why not MODELVIEW. That is I can not understand.

GL gl = drawable.getGL ();
gl.glMatrixMode (GL.GL_PROJECTION);

gl.glLoadIdentity ();

float aspect = (float) width/(float) height;
glu.gluPerspective (FOVY, aspect, NEAR, FAR);

gl.glMatrixMode (GL.GL_MODELVIEW);

_NK47
11-11-2008, 02:27 AM
that is important to understand. i suggest you read some docs/books about opengl before going any further. the projection matrix mode will tell opengl that we modify the projection matrix which is responsible for holding the projection (ortho/perspective f.e). the modelview matrix mode tells opengl that all opengl calls operate on the modelview matrix which is responsible to move around your camera and geometry in the world.