Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Diference between GL_MODELVIEW and GL_PROJECTION

  1. #1
    Junior Member Newbie
    Join Date
    Jun 2004
    Location
    somewhere
    Posts
    2

    Diference between GL_MODELVIEW and GL_PROJECTION

    hello.
    I'm trying to understand the diference between these two callings
    glMatrixMode(GL_MODELVIEW)
    and
    glMatrixMode(GL_PROJECTION)
    I am reading the redbook, i am reading tutorials but this topic is steel obscure for me.
    I don't know wnen to make the first call or the second.
    Can anyone help me out with few words? What is the diference. I don't mean the matrix stacks, but the essential diference...

    Thanks a million.

    tuko the mexican
    tuko

  2. #2
    Advanced Member Frequent Contributor
    Join Date
    Apr 2004
    Posts
    990

    Re: Diference between GL_MODELVIEW and GL_PROJECTION

    The modelview matrix defines how your objects are transformed (meaning translation,rotation and scaling) in your world coordinate frame

    The projection matrix defines the properties of the camera that views the objects in the world coordinate frame. Here you typically set the zoom factor, aspect ratio and the near and far clipping planes.

    So in most cases you would want to define the projection matrix just once and use the modelview matrix all other times.

    Greetz,
    Nico

  3. #3
    Member Regular Contributor
    Join Date
    Aug 2003
    Posts
    370

    Re: Diference between GL_MODELVIEW and GL_PROJECTION

    The projection matrix is used to create your viewing volume. Imagine a scene in the real world. You don't really see everything around you, only what your eyes allow you to see. If you're a fish for example you see things a bit broader. So when we say that we set up the projection matrix we mean that we set up what we want to see from the scene that we create. I mean you can draw objects anywhere in your world. If they are not inside the view volume you won't see anything. When you create the view volume imagine that you create 6 clipping planes that define your field of view.

    As for the modelview matrix, it is used to make various transformations to the models (objects) in your world. Like this you only have to define your object once and then translate it or rotate it or scale it.

    You would use the projection matrix before drawing the objects in your scene to set the view volume. Then you draw your object and change the modelview matrix accordingly. Of course you can change your matrix midway of drawing your models if for example you want to draw a scene and then draw some text (which with some methods you can work easier in orthographic projection) then change back to modelview matrix.

    As for the name modelview it has to do with the duality of modeling and viewing transformations. If you draw the camera 5 units back, or move the object 5 units forwards it is essentially the same.

    Hope I've shed some light.

  4. #4
    Junior Member Newbie
    Join Date
    May 2004
    Posts
    9

    Re: Diference between GL_MODELVIEW and GL_PROJECTION

    Also this url might be of assistance: http://sjbaker.org/steve/omniv/projection_abuse.html

    // ville

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •