How does OpenGL project a 3D point to screen?

I was wondering what kind of mathematical operation does opengl to convert a 3d point to a 2d screen point. Any doc where i can read about this?

It has to do with projection of vector’s from 3D space into the 2D screen, a very complex set of mathematical functions.

Even get more complex when you add lighting and textures.

Do a google search on rendering, which is what it is called with the 3D scene is projected on to the 2D screen.

I was wondering what kind of mathematical operation does opengl to convert a 3d point to a 2d screen point. Any doc where i can read about this?

Complex?I thought it was:multiply by modelview,clip,multiply by projection and divide by w.Maybe clipping comes last,not sure.

I have looked in google and i have found some documents about projecting 3D points, but none of them specifically explains what does opengl do…

If you take a look at the OpenGL specification , you can find out the formula it uses for just about everything. The formula you are looking for goes something like so…

From the spec with a few minor edits to account for no graphics
if a vertex in object coordinates is given by v(x0, y0, z0, w0) and the model-view matrix is M, then the vertex’s eye coordinates are found as

eye(xe, ye, ze, we) = M*v

Similarly, if P is the projection matrix, then the vertex’s clip coordinates are

clip(xc, yc, zc, wc) = P*eye

The vertex’s normalized device coordinates are then

dev(xd, yd, zd) = (xc/wc, yc/wc, zc/wc)

The viewport transformation is determined by the viewport’s width and height in pixels, px and py, respectively, and its center (ox, oy)(also in pixels)."

The vertex’s window coordinates (xw, yw, zw) are given by.

xw = (px/2)xd + ox
yw = (py/2)yd + oy
zw = [(f-n)/2]zd + (n+f)/2

The factor and offset applied to zd encoded by n and f are set using

void DepthRange(clampd n, clampd f);

[This message has been edited by Deiussum (edited 01-23-2003).]