Is the OpenGL Coordinate System right-handed or left-handed?

praveen picture praveen · Mar 2, 2011 · Viewed 9.7k times · Source

Say I am using an Identity Matrix for my modelViewTransformation Matrix on an OpenGL ES 2.0 program. The Co-ordinate system in this case is the canonical OpenGL co-ordinate system which extends from (-1,-1,-1) to (1,1,1).

Is this coordinate system right-handed or left-handed?

A broader question: Is there a document with OpenGL which can list all the mathematical conventions followed by the API?

Answer

Bob Cross picture Bob Cross · Mar 2, 2011

My question is, is this coordinate system right-handed or left-handed?

By default, OpenGL is always right-handed. You can observe this by the automatic normal creation. You can force a left-handed normal creation by specifying it per point but, in general, right hand rule applies all the time. See 9.150 in the OpenGL FAQ for more discussion of the right-hand-only nature of OpenGL.

... all the mathematical conventions followed by the API?

It's not clear what you're asking for. The math is basic linear algebra with a strong focus on matrix math and linear transformations.

EDIT to respond to comment question:

REMEMBER, however, that if you are using the uniform matrix calls rather than the older glRotates, etc, that you must specify whether you are using row-major or column-major matrices. In this case (from the code mentioned in the comment):

glUniformMatrix4fv(uniforms[UNIFORM_MVP], 16, GL_FALSE, mvpMatrixZRotation);

In this call, GL_FALSE is telling the call that this is a column-major matrix and, as such, the rotation that results will be the transpose of what was intended. Therefore, the rotation will be inverted, looking like a left-handed coordinate system.

Change that to GL_TRUE and all will be well.

Here is a very simple example from the OpenGL discussion board that's relevant to this specific topic.

Yet another edit to respond to the request for comment: Here is another detailed explanation of the matrix pipeline in OpenGL. Notice the GL_MODELVIEW diagram with the three axes: they illustrate the right-handed coordinate system. The above citation in the FAQ also still applies.