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?


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.


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.