Mimic glFrustum

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.

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.

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.