0
101 Jun 14, 2007 at 12:13

Hi,
When i use the glFrustum funtion to set up my projection matrix, it works fine. But as soon as I want to calculate the matrix myself, it does not work.

Following code works:

glViewport( 0, 0, (GLsizei)w, (GLsizei)h );

glMatrixMode( GL_PROJECTION );
glFrustum( -.4, .4, -.3, .3, 1., 1300. );
glMatrixMode( GL_MODELVIEW );

// continues


the following does not :(

glViewport( 0, 0, (GLsizei)w, (GLsizei)h );

glMatrixMode( GL_PROJECTION );
matrix4x4 projection;
projection = calculateFrustum(-.4, .4, -.3, .3, 1., 1300.);
glMatrixMode( GL_MODELVIEW );

// code continues


Some how my calculation of the Frustum matrix does not match that of the one calculated by the openGl. Can you please point out whats wrong in here.

I am using the defination given on the following page for “calculateFrsutum” funtions call:

http://msdn2.microsoft.com/en-us/library/ms537094.aspx