Results 1 to 2 of 2

Thread: Projection matrix

  1. #1
    Member Contributor
    Join Date
    Apr 2007
    Posts
    80

    Projection matrix

    Hi,

    someone can explain me what does establish the Projection matrix? and how can i modify it or create a new one?

    Is there any direct relation between the Projection matrix and the frustum that can create glOrtho o gluPerspective?

    Thanks

  2. #2
    Junior Member Newbie
    Join Date
    Aug 2006
    Location
    Colorado, USA
    Posts
    1

    Re: Projection matrix

    You are correct in that there is a tight relationship between the frustum and projection matrix. The project matrix changes the scale of things in order to cull at -1 to 1 (if I remember right).

    Anyway, this is why you first call:
    glMatrixMode(GL_PROJECTION);

    and set identity matrix and then your calls to glOrtho or gluPerspective(). You can even call glFrustum() if you want, but I like gluPerspective().

    Don't forget that after you've taken care of the perspective transform it's then time to put the matrix mode into GL_MODELVIEW so the rest of your code works. Remember, OpenGL is very "state" based and in the Model-View state we are thinking of moving the camera, moving our models and no longer in the "frustrum".

    Does this help?

    - Michael L. Croswell

    PS: I did a search and found some example code at my old school (I actually took this CS410 course over a decade ago and we had to implement a ray-tracer by hand with only the ability to draw one pixel-at-time - it took minutes to render a frame!)
    The link shows some code (written by Andy Curtis) at:
    http://www.cs.colostate.edu/~cs410/r...kat/lookat.cpp

Similar Threads

  1. Replies: 0
    Last Post: 09-16-2015, 03:27 PM
  2. Using modelview/projection matrix to do a projection myself
    By AllForum in forum OpenGL: Basic Coding
    Replies: 3
    Last Post: 08-30-2012, 07:42 AM
  3. OpenGL Projection matrix to intrinsic matrix
    By Elimentz in forum OpenGL: General
    Replies: 18
    Last Post: 10-20-2011, 06:26 AM
  4. Projection matrix, arbitrary projection plane
    By omdown in forum OpenGL: General
    Replies: 0
    Last Post: 04-01-2010, 07:26 AM
  5. Can concatenate projection matrix with viewport transformation matrix?
    By MelvinEng in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 07-07-2002, 10:31 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean