Ortho and frustum question.

Hello,

You can find my source-code here. 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
or
./kubus f

If you ever need more information please, do ask!

Regards Anon5710

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.

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

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.” ?

Yeay that’s a perfect example of writing one thing but meaning an other.

Ofcours it has to be positive. :slight_smile:

Ok :slight_smile:
So you still have your problem or not?

yes, on both questions.

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.