PDA

View Full Version : glFrustum



12-03-2000, 09:19 PM
Hi all,

as far as I know glFrustum() is changing the perspective of viewing the scene.

I've tried to do something with the command, but, no matter what values I add, it won't change anything on the perspective. When do I have to state it exactly, to get a result?

My looks like the following:

glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glFrustum (-1.0, 1.0, -1.0, 1.0, 3.0, -3.0);
glTranslatef(0.0f, 0.0f, 1.0f);

glMatrixMode (GL_MODELVIEW);
glLoadIdentity();
glPushMatrix();
[...]
glBegin (GL_QUADS);
glArrayElement(0);
glArrayElement(1);
glArrayElement(2);
glArrayElement(3);
glEnd();
[...]
glPopMatrix();

Any answer, would help.

Thanks,

Daniel

12-04-2000, 12:09 AM
Try something like this
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
glTranslatef(0.0f, 0.0f, 1.0f);
glFrustum (-1.0, 1.0, -1.0, 1.0, 3.0, -3.0);

Otherwise you won't translate neiter the frustum view or the objects.

Bob
12-04-2000, 02:44 AM
First, you shouldn't transform the projection matrix unless you know what will happen and this is what you want. It can/will mess up a few things in OpenGL (like fog, lighting, environment mapping, and maybe some more things).

Second, when using glFrustum, near clipping plane must be less than the far clipping plane, and the near plane must be greater than zero. Using negative numbers or zero on either near of far plane, will generate an error code.