# glFrustum (.....)

### #1me_here_me

New Member

• Members
• 24 posts

Posted 14 June 2007 - 12:13 PM

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.microso...y/ms537094.aspx

### #2Reedbeta

DevMaster Staff

• 5340 posts
• LocationSanta Clara, CA

Posted 14 June 2007 - 04:18 PM

Make sure you store your matrix in column major order, since that's how OpenGL will expect it. The "natural" way to store a matrix in C uses row major order. You'll have to transpose to interchange the two.
reedbeta.com - developer blog, OpenGL demos, and other projects

#### 1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users