Clipping depth...

I’m having a problem with the clipping depth. I have a cube…and when I zoom out I want it to get to be a few pixels big, but rather it snaps out when it’s still rather large…any suggestions?

  • Derek

Your farplane (at least) needs adjusting.
I typically use about 4 for my nearplane and 4000 for my farplane and I don’t have any problem zooming out (while rendering unscaled Q3A models).

I had a feeling it was something like that. What’s the code I need to insert to change those?

  • Derek Doucett

You can change the far clippingplane with three functions.
Either change gluPerspective or glFrustum or glOrtho (depending on what function you are using). It’s the last parameter in each of the above functions that specifies the far clippingplane, and you need to set a bigger number.

Okay got it Now I have one more question. I’m using glPerspective, I know glOrtho is for 2d. What’s glFrustum?

  • Derek Doucett

gluPerspective is basically a friendlier version of glFrustum. But not every body has the glu library. To make your app user friendly (by being more reliable and possibly faster), stay away from glu functions. That’s what I’ve come to learn any way. It is very easy to write your own version of gluPerspective using glFrustum too (which is what I do, and yes, I learned it from perusing the glQuake source code).

[This message has been edited by DFrey (edited 06-18-2000).]

gluPerspective isn’t friendlier. You have to use an angle and you need to do calculation to get what you want.

check that post. I explain how glFrustum work

On the contrary Gorg, I’ve never had to calculate that angle. Instead I merely choose what I want my fov to be and that’s what I put there. The only calculation that may be needed is changing fovx to fovy, which in itself is nothing spectactularly difficult to understand.

I feel the problem is the angle, when I look at something, I look at the proportion it gives. I don’t have some sort of pre-defined angle in my head.

Anyway, I am too aggressive in my comments about glFrustum, everything is a choice. You seem to understand very well how to work with gluPerspective and that is absolutly great and I should not be saying anything!

So, use whatever you like an be happy!!


Derek Doucett wrote: >>I know glOrtho is for 2d. What’s glFrustum?

To make something clear, glOrtho is for 3D, as is glFrustum. glOrtho creates an matrix that does orthogonal projection (more or less, screen x/y is same as world x/y after transformation) .

And as Gorg says. When you want to fit an object completely in the frustum, you will encounter some problems when using gluPerspective.