PDA

View Full Version : Handedness



adrianmay
12-05-2011, 03:14 AM
Hi folks,

The current ES 2.0 standard says in corrolary 7: "The GL does not force left- or right-handedness on any of its coordinate systems"

What does this mean? An implementation can't help choosing left or right handed-ness. If that seems debatable, just make a tetrahedron with opaque faces and a blue peak pointing towards +ve z. Render it with no transforms at all but depth filtering, and either you see blue or you don't.

On my HTC Desire, I don't see blue, which (having used other colours to confirm that x is rightwards and y is towards the top of the screen) makes it a left handed coordinate system. This was a great surprise for me because all over the web it says that OpenGL is right handed.

So what's the deal with ES 2.0? Is this a bug in my phone or are they allowed to do this under the spec?

It would seem completely mad if every implementation was allowed to flip a coin over the handedness. That would make it impossible to write software that looked the same everywhere. But that corollary seems to mean just that.

Please explain.
Adrian.

Xmas
12-08-2011, 04:21 AM
What does this mean? An implementation can't help choosing left or right handed-ness. If that seems debatable, just make a tetrahedron with opaque faces and a blue peak pointing towards +ve z. Render it with no transforms at all but depth filtering, and either you see blue or you don't.
By default clip space +X is right in screen space, +Y is up, and +Z is far, actually making clip space left-handed. While you cannot change the mapping direction of the first two (negative viewport width and height are not accepted), you can change the latter by selecting a different depth comparison (e.g. GL_GEQUAL instead of GL_LEQUAL).

In OpenGL versions with a matrix stack, glFrustum and glOrtho actually produce projection matrices that silently invert the Z axis, thus typically making the source space ("view space") right-handed. But the user is able to change it.