do you have backface culling activated?
Would look like:
GL_BACK is the initial value, therefore it dont have to appear in your code, but it would be good to know if you use "glEnable(GL_CULLFACE)".
I am asking this because even the second order of vertices should not give you the right result if backface culling is enabled and
is not used. glFrontFace sets the winding order of vertices in OpenGL and its default is GL_CCW. Therefore by default the order of vertices should be counter clockwise.
In your second example they are clockwise, which would mean that the quad is oriented away from the screen(viewer) and if backface culling is enabled you should not see anything. (backface culling means that only the front face is rendered and visible)
I think the right order should be as an example:
glBegin(GL_QUADS) glVertex2f(-0.5,-0.5);//0 glVertex2f(-0.2,-0.5);//1 glVertex2f(-0.2,-0.2);//2 glVertex2f(-0.5,-0.2);//3 glEnd();
every other counter clockwise order is fine too.
Even if the quad is divided (which is the only way in modern opengl, where GL_QUADS is deprecated and deleted) in two triangles botth of them (0,1,2) and (2,3,0) have the right winding.
I have no clue why the first result is looking like this, but I dont found a specification how exactly GL_QUADS works.
What I would do is enable backface culling and then try it, because then you are learning it the right way and you dont have to struggle again when you need to use backface culling. And like DiegoSLTS suggests I would use triangles, because this is the way to go in OpenGL 3.0 and higher.
I know that were perhaps alot of information and I did not explain everything in depth, please feel free to ask.