PDA

View Full Version : Mimic glFrustum



glfreak
06-22-2010, 10:42 AM
I'm trying to construct the Frustum perspective projection matrix as defined in the GL spec 2.1. and pass it to the shader instead of using the fixed functionality pipeline.

The result is that my geometry is scaled down by half or so.

Is not it the same matrix generated by the glFrustum?

Is there an extra step I need to do prior to passing this matrix I create?

Thanks.

Dark Photon
06-22-2010, 02:41 PM
Is not it the same matrix generated by the glFrustum?
Call glFrustum, query back the matrix and compare. If difference, look at the Mesa3D source code for glFrustum and/or look at the perspective matrix in the back of the red book (http://glprogramming.com/red/appendixf.html).


Is there an extra step I need to do prior to passing this matrix I create?
No. Only thing factor-of-two trips in my mind is what should be handled in the viewport transform (NDC -1..1 -> 0..1 scaled to viewport width/height). But I assume you're using the same glViewport transform.