View Full Version : Ortho and frustum question.

07-25-2008, 12:46 PM

You can find my source-code here (http://www.highvoltage.be/school/oef4.tar). It includes a runable file (linux only tough), the source code and the makefile.

I'm having troubles understanding how to use the ortho and frustum.
I need to define a clipping volume for both.

I define this clipping volume the same size as the cube i'm displaying. however nothing shows up. when i start with option 'o' or 'f'

An other question, when i rotate the camera position i can see trough the cube. How did i do this? Is there a way so that i can only see what i should normaly see.
You can move the camera arround with q,f,e and d.

To use frustum or ortho you need to
./kubus p
./kubus f

If you ever need more information please, do ask!

Regards Anon5710

07-25-2008, 01:03 PM
in your code, you set a negative value for near, you have to put positive values instead. Even if your are looking toward negative z, opengl take the opposite of near and far.

07-26-2008, 12:14 PM
Even with those value's set negative, it doesn't show anything.
The value's in kubus.h aren't used anyway. (i should delete them)

I have setted those value's in the functions them self

07-26-2008, 12:19 PM
I did not looked at kubus.h , I just see that in your function myinit you set negative values for near.

near and far have to be positive, negative values for them is simply forbidden and generates an opengl invalid error.

I am not sure to understand your answer, should not be:

"Even with those value's set positive, it doesn't show anything." ?

07-26-2008, 10:50 PM
Yeay that's a perfect example of writing one thing but meaning an other.

Ofcours it has to be positive. :)

07-27-2008, 11:36 AM
Ok :)
So you still have your problem or not?

07-27-2008, 03:00 PM
yes, on both questions.

07-28-2008, 05:16 AM
maybe try to use a bigger clipping volume setting bigger values in the glFrustrum function because the clipping volume you set is as big as the cube you draw. This explain why you can see through the cube.

Seeing throw the cube is due to the near clipping plane that may be too close to the geometry. The solution is to move this plane closer to the eye or move back the camera.