See I’m using glFrustum(0, 1, 0, 1, 0, 1); SO I expect my quad’s (0,0) to be mapped to display window’s bottom left corner and (1,1) mapped to Top-right corner. But instead my display is blank. Can anyone tell why ?
For a perspective projection, you should probably look at gluPerspective instead of glFrustum. It doesn’t sound like you understand glFrustum very well. Also, for a perspective projection you should always have the near plane > 0.
Here’s just a quick explanation of how you can think of glFrustum… for more detailed calculations, you should become friends with Google.
Picture your eye at the 0,0,0 point of a pyramid. The near defines how far from your eye the top of the pyramid will be chopped off. The far value defines what the bottom of the pyramid will be. The left, right, top, bottom define the size of the rectangle that is cut by the near plane.
So, basically by specifying 0, 1 for left/right, and 0, 1 for top/bottom you are already skewing the shape of the viewing volume. You esentially have a pyramid where the point isn’t in the middle, but right above one of the corners.
I’ll attempt a rough ascii drawing of what you get…
Top view of pyramid. (x indicates the apex)
------
| /|
| / |
| / |
|/ |
x-----
Side view:
x
|\
| \
| \
| \
-----
Notice that if you keep the size left/right, top/bottom the same, but change the distance to the near plane, your field of view changes drastically. And as that distance approaches 0, you can run into problems.
Essentially, you end up getting a field of view based on the distance of the near plane and the size of the near plane (determined by left/right top/bottom).
you havent used gluLookAt (). this might be the
reason for the blank screen.
use gluLookAt(0,0,5,0,0,0,0,1,0); to position
the camera 5 units away from the screen on z axis