Noobie Question: Depth buffer setup

Hi Guys,

Brand new to openGL and 3d stuff. I am still trying to wrap my head around a totaly new way of thinking. So please be gentle. I got a very newbee question. What would be the steps in openGL coding (from start to end in c++) to get depth buffer values. To make it simple I am trying to work only on a single triangle, i know the clipping planes, the camera location, looking at the origin and the up vector being -z axis.

Now i have gone as far as this:

glMatrixMode(GL_MODELVIEW);
glLookAt(…);
gluProject(…);
glFrustrum(…);
glViewPort(…);

I think these are the right steps. I am not sure what would be calls after this to get to glReadPixels(…).

One of my freinds suggested I use gluProject/gluUnproject. but that seems to include some of the functionality of these above calls built into it. Also, I think I would learn better if I know each function call individually so that I know what they do. Once I understand how to get this done with individual calls I can use the gluProject I guess.

Please, any help will be appreciated. I know I just did a very crude representation of my problem. I you would like I can post all the data that I have.

HELP…

You need to pick up the Red Book (i.e. OpenGL Programming Guide) and read a bit. Just google for OpenGL tutorials, and this kind of thing will be the first tutorial on each list. For instance:

One of my freinds suggested I use gluProject/gluUnproject. but that seems to include some of the functionality of these above calls built into it.

You wouldn’t use these to render a triangle. These are used to transform some points on the CPU (e.g. before or after rendering).

Also, I think I would learn better if I know each function call individually so that I know what they do.

Agreed. That’s why you need to get the Red Book and read. The manual pages or the specs aren’t the place to go if you’re just starting out. You need to understand how the pipeline works first.

Once I understand how to get this done with individual calls I can use the gluProject I guess.

For what?