Friday, March 1, 2013

OpenGL seems to use left-handed convention

Ok, so for many years I was under the impression that OpenGL uses the right-handed rule to define how its Z axis works, meaning that the more the Z coordinate increases, the closer it gets to the viewer.

However, having just recently experimented with writing a bare vertex shader (without any view or projection matrices), I have found that OpenGL actually uses the left-handed rule (the more the Z coordinate increases, the further away from the viewer the object becomes).

Conclusion: if you want to use the right-handed rule, you simply need to setup your projection matrix accordingly (which I won't discuss here since I have not verified what the matrix should be exactly so I don't want to speculate).

No comments:

Post a Comment