projection problems

I need to be able to redefine glFrustum as i move the camera around
my world to maintain the distance between the camera and the VRP.
I have set glFrustum to

glFrustum(-81.5, 81.5, -55.0, 55.0, frontPlaneDistance, backPlaneDistance);

in the init and resize functions.

I have set my lookAt function to

gluLookAt (-4.0, 0, -viewPlaneDistance, 0.0, 0.0, 0.0, 0.0, 1.0, 0.0);

The set up is that frontplane and backplane are set that they are constant
distances from viewplane.

But when I try to run this i get a blank screen, but when i replace these
variables with actual values the scene renders correctly.

So what am I doing wrong?

Thanks

Hi Dave_1234,

If you’re coming from the PHIGS world, then VRP is analogous to the eye position, or the “eye” parameters in LookAt. VPN is derived from the “eye” and “center” parameters; VUV is derived from the “up” vector.

Your glFrustum parameters look a bit out of line to me. The values in question (left,right,bottom,top) are typically based on the field of view. You might try gluPerspective, initially, for comparison.

A sample use of glFrustum:

float winAspect = (float)winWidth / (float)winHeight;
float scale = tan( fieldOfViewInRadians / 2 );
glMatrixMode( GL_PROJECTION );
glLoadIdentity();
glFrustum( 
-winAspect * scale  , winAspect * scale, 
-scale              , scale, 
 1		    , 1000 
);

Otherwise, it might help if you post actual code that demonstates the problem.

Hmmm, maybe I missed something.

[edit: Some things I missed]