Viewing volume

Hello everyone.

Im getting confused about specifying the viewing volume…I was trying to see how changing the viewing volume affects the object.So this is what i did:
void display()





Whats really confusing me is the near and far parameters for glOrtho.

Here,i could see the line drawn when i gave near and far as:
near 0.0
far 100.0

the line was also visible when i gave
near 100.0
far 0.0

Now my question is:

1)How are near and far assigned??
2)Doesnt the near, far parameters depend on the camera??
(I mean are ther wrt the camera positon?)

Here,my camera is at origin.
So does it make sense if i give near as say 100?? How can the camera view it?!

I tried googling about it…But all that made me even more confused!
Im very new to OpenGL…
Please Help.Thanks in advance.

Near and far are defined in eyespace. With ortho you’re really defining a box in 3D within which things will be visible to the screen.

You can comfortably make near negative with ortho without ill effects.

If you have identity on the modelview than anything inside the ortho box will be visible.

Camera? There is no camera.

Think of the coordinates as mapping straight to the screen viewport and then you step in to transform them. The ortho call defines the 3D volume that is projected to the viewport. Including the bounds in terms of near and far.


The Red Book as some explanation of this stuff.

Thanks Dorbie.I checked out the RedBook…

This part wasnt clear to me:

“With no other transformations, the direction of projection is parallel to the z-axis, and the viewpoint faces toward the negative z-axis. Note that this means that the values passed in for far and near are used as
negative z values if these planes are in front of the viewpoint, and positive if they’re behind the

So does this mean if my near = -100 and far = 100, i have a viewing volume from z=-100 to z=100??
(that is whithout any other transfornation)

In the example i had posted above, this is what happened:

if i give near = -100 ,far = 100,ine is visible.
if i give near = -100 ,far = 0 ,line disappears
if i give near = 100 ,far = 0 ,line appears
if i give near = 100 ,far = 100,line is still visible!!

How is this??
Can you please explain how the 3D volume is set in all 3 cases…

And this is what i read in another book.Interactive Computer Graphics,Edward Angel.

This is what it said:

“Note that all parameters(referring to glOrtho parameters) are distances measured from the camera(viewpoint) The orthographic projection “sees” only those objects in the volume specified by viewing volume.Unlike the real camera, the orthographic projection can also include objects behind the camera(viewpoint)”

Now based on the above explanation, it makes sense what happened in the program.

One more thing,in your post, you said “Camera?There is no camera.”

Why is it?? We can visualise the system as being modelled by a camera or an eye right??

Camera implies a perspective projection IMHO.

Ortho is simply an eyespace box. Now you can move that box around but it’s simpler for beginners not to think of it as a camera IMHO.

Initially with identitu modelview and ortho on the projection you have an eyespace box which matches the world and object space.

i.e. the origin of the box is at the origin of the world

If you move the world or the eye by manipulating the modelview (both effects are equivalent but use inverse transforms of theother) the box centered around the origin and looking down the z axis will no longer be centered around the origin and looking down the z axis.

Camera is just a word here, the camera origin is located at the eye. But with ortho it is important to realize that the projection is not always centered at the “eye”. You can define a volume around the “eye” but you can define a volume in front of above to the side or behind the “eye”. The “eye” needn’t be inside the visible ortho defined volume, the volume is merely defined relative to the “eye”.

With a perspective projection the eye is always at the origin of the projection and it makes more sense to call it an eye or a camera, but the eye/camera is NEVER on screen with perspective projection however it is right to call it the eye as the center of projection.

Thanks a lot Dorbie!