PDA

View Full Version : Face position



mikeg
08-21-2004, 07:51 PM
I have assumed that the coordinate system is right-handed, is that correct? z-axis out of the screen is positive.

I have created a 3d cube center at the origin. I assumed that a vertex of (0.5, 0.5, -0.5) or any vertex with a z-coordinate of -0.5 would be a vertice on a back face but it appears that my backface is my front face.

Thanks, Mike

dorbie
08-22-2004, 11:46 AM
Your assumption is correct initially with an identity modelview matrix and a normal projection matrix. Intuitively when drawing, eyespace still has z pointing out from the screen positively when identity is on the modelview. Face winding & culling will also affect what is visible so remember that the order of vertices on individual primitives can affect their visibility. Without a depth buffer and testing on the painters algorithm is in effect so last thing drawn is always visible.

Additionally, the projection matrix created by glFrustum places a -1 in the appropriate place to reverse the direction of stored z (and make a few other adjustments between near & far). The viewport xform also adjusts the depth range, however this is all for post projection interpolation and storage in the depth buffer which you don't really see unless you read the depth buffer us are assuming that the depth tests should match your perception of eyespace depth.

**Post projection depth buffer does not match eye space z**