The canonical scope of the view, as well as the normalized coordinates of the device, is / left. This is easy to verify by passing the identity matrix and drawing two triangles:
float points[] = { -1, 1, -0.5, -1, -1, -0.5, 1, -1, -0.5, 1, 1, 0.5, -1, -1, 0.5, 1, -1, 0.5 };
and looking at the results (with glEnable (GL_DEPTH_TEST))
So your vertex shader will look like this:
uniform mat4 mvp_mat; // Incoming per vertex... position (fills in 1 for w if from vec3 buf) layout (location = 0) in vec4 v_vertex; void main(void) { // multiplying by identity doesn't transform the geometry gl_Position = mvp_mat * v_vertex; }
or you could even test it more simply since the identity matrix does nothing
layout (location = 0) in vec4 v_vertex; void main(void) {
Obviously, you will need to make the colors of the triangles different so that you can see how they overlap.
Also see this post and my comment / question in it: plus.google.com/114825651948330685771/posts/AmnfvYssvSe
I donβt know where all the wrong information comes from the Internet and even into textbooks. OpenGL only works by default if you are talking about a triangular winding to determine the front edge (CCW by default = right). World space, object space and eye space does not exist for OpenGL, only for a graphic programmer. OpenGL just takes the dots, clamps something outside the scope of the canonical representation [-1, -1, -1] x [1, 1, 1] and converts them to screen / window coordinates, which are [0, w by default) x [0, h) x [0, 1]. If depth checking is enabled, the default behavior is left, looking down + z.
There are several ways to account for OpenGL's left hand. Most people deal with this in their matrices (although they do not understand this). I think you can also change it with glDepthFunc and set it to GL_GREATER.
http://www.opengl.org/sdk/docs/man3/xhtml/glDepthFunc.xml
Further evidence that it is left is here http://www.opengl.org/sdk/docs/man3/xhtml/glDepthRange.xml
"After clipping and dividing by w, the coordinates of the depth vary from -1 to 1, which corresponds to the plane of near and far clipping," that is, a positive z goes to the screen = left. You can also use DepthRange to change the behavior on the right.
EDIT: In response to Bob Cross's insistence that I am mistaken, there is only one file program that shows that I am right. https://github.com/rswinkle/opengl_reference/blob/master/src/left_handed.c
You can see the screenshot in README https://github.com/rswinkle/opengl_reference