gluPerspective Near and Far Plane

Hi!
I create my viewing volume with:
gluPerspective(angle, (GLfloat)w / (GLfloat)h, radius/100, 3radius);
Then i wanted to create a quad at the near and at the far plane, which fill the whole plane. I thought that the width
and the height on the near plane are:
heigth=tan(angle)radius/1002
width=height
w/h
and for the far plane:
heigth=tan(angle)radius32
width=height
w/h

But these values does mot match ??
Thanks
Juergen

Why not switch to an orthographic projection while drawing the quad? It’s alot easier to get it to cover the entire screen that way.

Why is it easier?

It’s easier because for instance, you don’t have to do any calculations to figure out the near clip plane. For instance if you used…

glOrtho(-1, 1, -1, 1, -1, 1);

You just draw your quad where one corner is at -1, -1, 0 and the other is at 1, 1, 0.

Anyway, your formulas seem off. If you have the following call…

gluPerspective(fov, aspect, near, far);

The formulas would be something like so…

maxY = tan(fov/2) * near;
minY = -maxY;
maxX = maxY * aspect;
minX = -maxX;

The far plane has the same formulas only you substitute far for near.

[This message has been edited by Deiussum (edited 07-07-2002).]