PDA

View Full Version : Left or right handed coordinate system?



Sig Wong
03-26-2005, 07:19 PM
I could be mistaken, but it seems to me that OpenGL uses the Left-Handed Coordintate System (the Z axis grows more positive as it moves into the screen, and more negative as it moves toward the viewer).

Personally, I think this makes loads more sense than the Right-Handed Coord System, but all the 3d Modeling/Animation etc apps I've seen (namely Animation:Master and Strata3D CX) seem to use the Right-Handed System (z-axis increases toward the viewer, blah blah blah). I'm fairly certain that both of these programs use OpenGL.

So mainly I want to know:
A) For modelling and animatoin purposes, is the right-handed system superior?
and
B) If so, is there any way to make OpenGL use the right-handed system short of inverting the sign of every z-axis value on every vertex?

thanks in advance,
-sig

t3jem
03-26-2005, 07:33 PM
Not sure exactly what u mean but from what I have learned the opengl modeling functions use a right handed system, but the camera functions use a left handed system. Don't ask me why this is just what I have read in my book.(though it's been awhile)

Overmind
03-27-2005, 02:23 AM
None of these systems is superior to the other, it is just a matter of convention...

OpenGL uses the right handed coordinate system by default, that is, X goes to the right, Y goes up and Z goes out of the screen. After projection it is left handed, but that has something to do with how the depth buffer is organized and normally you need not be concerned with it.

Switching to a left handed coordinate system is very easy, just flip the Z axis in the modelview matrix with glScale3d(1., 1., -1.). Don't forget to change the vertex winding, too, because otherwise front and back faces will be swapped.