View Full Version : When is the glFrustum applied to a polygon
03-02-2010, 07:15 PM
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?
03-02-2010, 07:27 PM
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 (http://www.glprogramming.com/red/chapter03.html) chapter in the Red Book.
In general, if something affects drawing, you should set it before issuing draw commands.
03-03-2010, 01:12 AM
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.
Powered by vBulletin® Version 4.2.2 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.