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 3 of 3

Thread: When is the glFrustum applied to a polygon

  1. #1
    Junior Member Newbie
    Join Date
    Oct 2009
    Posts
    7

    When is the glFrustum applied to a polygon

    Hi Guys,

    If I have a triangle(s) declared using glBegin/End and then make a call to glFrustum(..), does the frustum matrix gets applied to the triangle vertices also?
    if yes then is this done automatically?
    and if not then does it even matter when the glfrustum is called and when the triangle is declared?

    Also, how does glviewport(..) affect the vertices?

  2. #2
    Junior Member Regular Contributor pjcozzi's Avatar
    Join Date
    Jun 2004
    Location
    Philadelphia, PA
    Posts
    196

    Re: When is the glFrustum applied to a polygon

    Hi,

    Call glFrustum before drawing (calling glBegin/glEnd). glFrustum defines the projection matrix (assuming that is current when it is called) that is used to transform the vertex positions used for drawing.

    Likewise, you should also call gluLookAt, which defines the view matrix, and glViewport, which defines the transformation to window coordinates.

    For more information on what exactly these transforms do, check out the Viewing chapter in the Red Book.

    In general, if something affects drawing, you should set it before issuing draw commands.

    Regards,
    Patrick

  3. #3
    Super Moderator OpenGL Guru dorbie's Avatar
    Join Date
    Jul 2000
    Location
    Bay Area, CA, USA
    Posts
    4,388

    Re: When is the glFrustum applied to a polygon

    glFrustum is not applied to a polygon.

    glFrustum is applied to the matrix currently defined by glMatrixMode.

    Typically it is applied to the projection matrix.

    The vertex is multiplied through the projection matrix AFTER is is multiplied through the modelview matrix and before it is clipped and normalized to device screen space using the values set by glViewport.

    Typically you set up your matrices and viewport then send vertices. The transformations happen automatically unless you are using shaders in which case only the glViewport will happen automatically.

Posting Permissions

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