My understanding of OpenGL rendering was that without a depth test, objects would be drawn in sequential order, so that the last render function you call will draw its shape on top of whatever has already been drawn. I'm finding that this seems to not be the case however:
glDisable(GL_DEPTH_TEST);
glDisable(GL_ALPHA_TEST);
glColor3f(1.0, 0.0, 0.0);
glBegin(GL_QUADS);
{
glVertex2f(50, 50);
glVertex2f(100, 50);
glVertex2f(100, 100);
glVertex2f(50, 100);
}
glEnd();
glColor3f(0.0, 0.0, 1.0);
glBegin(GL_QUADS);
{
glVertex2f(30, 60);
glVertex2f(110, 60);
glVertex2f(110, 90);
glVertex2f(30, 90);
}
glEnd();
Rather then the red square under the blue square, which I would expect, these calls give me a red square over a blue square!
Do I not understand how OpenGL Rendering works? Or am I just missing some kind of option or configuration thats not letting the blue square render over? I am using a custom (but very simple) shader, would that change anything?
The non accepted answer to this question seems to imply that sequential rendering doesn't in fact occur and is implementation specific, but its accepted answer implies it is in fact the case.
Whats the best way of making the second call on top? I don't really want to have to have some kind of global z value that I keep on incrementing throughout the program.