Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 1 of 2 12 LastLast
Results 1 to 10 of 12

Thread: How do I read the view frustum parameters?

  1. #1
    Intern Newbie
    Join Date
    Feb 2002
    Location
    Hong Kong
    Posts
    44

    How do I read the view frustum parameters?

    Hi

    I know how to SET the frustum parameters using glfrustum but how do I READ them?

    I want to know the current size, position and, distance from the viewpoint, of the image (near?) plane.

    cheers

  2. #2
    Junior Member Newbie
    Join Date
    Sep 2000
    Posts
    20

    Re: How do I read the view frustum parameters?

    Hi

    The easy way, copy what someone else did

    http://www.markmorley.com/opengl/frustumculling.html

    Above is a very good tutorial on Frustum culling, part of this is extracting the Frustum planes. I hope this is what you were looking for.

    3DG

    [This message has been edited by 3DG (edited 02-22-2002).]

  3. #3
    Intern Contributor
    Join Date
    Jul 2001
    Location
    Chennai, TN, India
    Posts
    63

    Re: How do I read the view frustum parameters?

    use glGet(GL_PROJECTION_MATRIX,...)
    The Projection Matrix has all the information you need, to get the individual parameters, you need to find some way of solving this matrix. glFrustum() documentation has information on these values and how the matrix was constructed.

    -Sundar



    [This message has been edited by Sundy (edited 02-22-2002).]

  4. #4
    Intern Newbie
    Join Date
    Feb 2002
    Location
    Hong Kong
    Posts
    44

    Re: How do I read the view frustum parameters?

    brilliant.

    Many thanks guys.

  5. #5
    Intern Newbie
    Join Date
    Feb 2002
    Location
    Hong Kong
    Posts
    44

    Re: How do I read the view frustum parameters?

    Hi again.

    Im still trying to get the size and position of the near plane. Also the distance to the far plane.

    The code example shows how to get equations for all 6 viewing frustum planes. I guess by working out intersections etc , i can get the information I need. However this is not so simple.

    The documentation for glget(GL_PROJECTION_MATRIX) in MSDN at least is well nigh useless because it doesn't describe what the 16 values represent.

    Surely there must be an easy way to read the viewing frustum data.

    Or can anyone tell me the default values for the viewing frustum?

    cheers

  6. #6
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Posts
    531

    Re: How do I read the view frustum parameters?

    The documentation for glget(GL_PROJECTION_MATRIX) in MSDN at least is well nigh useless because it doesn't describe what the 16 values represent.
    I'd recommend you to learn something about matrices first (and trigonometry would also be nice) before diving into this stuff because you won't get far when you don't even know what those 16 values represent..

    (no offense, but it'll be a lot easier when you know the basics)

    Hint: Matrix FAQ

  7. #7
    Intern Newbie
    Join Date
    Feb 2002
    Location
    Hong Kong
    Posts
    44

    Re: How do I read the view frustum parameters?

    Excellent link thanks.

    However I do understand matrices quite well.

    Perhaps Im expecting too much from OPenGL but why should it be so much trouble to find some basic information about the viewing volume?

    Ive even spent the last couple of hours search for "opengl default viewing paramters" (or similar) and I STILL dont know the default parameters!

    Anyway Ill keep trying. Im new to this OPenGL programming caper.

  8. #8
    Advanced Member Frequent Contributor
    Join Date
    Oct 2000
    Location
    Belgium
    Posts
    857

    Re: How do I read the view frustum parameters?

    Originally posted by rangers99:
    Or can anyone tell me the default values for the viewing frustum?
    All matrices (MODELVIEW, PROJECTION, TEXTURE) default to the identity matrix. For the projection, this is equivalent to a frustum that is a unit cube centered on the origin.

    If you're ever in doubt about what the default state for something is, the OpenGL specification is the only place you need to look.

    -- Tom

  9. #9
    Intern Newbie
    Join Date
    Feb 2002
    Location
    Hong Kong
    Posts
    44

    Re: How do I read the view frustum parameters?

    cheers mate.

  10. #10
    Senior Member OpenGL Guru zed's Avatar
    Join Date
    Jul 2000
    Location
    S41.16.25 E173.16.21
    Posts
    2,609

    Re: How do I read the view frustum parameters?

    check the red book (appendix) for info on how the projection matrix is calculated (u can easily write your own then + call it with glLoadMatrix(..))

Posting Permissions

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