transformation - When is Z axis flipped? (OpenGL) -


to improve understanding of opengl , 3d trying implement simple rendering pipeline running on cpu. makes sense, i'm trying use same standards opengl. example, i'm using right handed coordinate system like opengl. happens when learning new, i've run question cannot find answer to. if in following doesn't make sense, please forgive , correct me.

in clip space (the coordinate give gl_position in vertex shader), negative z away user. in depth buffer, positive z away (if you're using default depth settings).

one answer this question suggests flip due projection transformation. made a little experiment (based on webgl/opengl es) suggests opposite: in clip space, z pointing away user if don't use projection transformation.

so @ point, after you've handed gl_position, opengl flips z coordinate. when , how that?

my guess is in viewport transform haven't been able find documentation supports this.

clip-space in opengl left handed (and was). so, in modern gl there no space explicitely using right-handed system, , there no "flipping" done @ all. however, eye space in old gl defined right-handed, , "flipping" done part of projection matrix, glfrustum() , gluperpective() explicitely expect positive values near , far refer repsective negative z values. however, use arbitrary matrices, never forced define eye or object spaces right-handed, default convention. , still lot of people follow convention programmable pipeline.


Comments