Hi List, I´m having a problem using GL_TRIANGLES to replace GL_QUADS.
Suposse you have this vertices:
v0=0,1,1
v1=-1,0,0
v2=0,1,-1
v3=1,0,0
If I want to draw a quad (in OpenGL) I have to do something like this:
GLfloat vertices[] = {v0,v1,v2,v3};
…
glVertexPointer(3, GL_FLOAT, 0, vertices);
glDrawArrays(GL_QUADS, 0, 4);
If you change the vertices position the result is the same. The vertices {v0,v1,v2,v3}, {v1,v2,v3,v0}, {v2,v3,v0,v1}, {v3,v0,v1,v2} make the same result.
Now I want to make this quad in OpenGLES. I read in some forums, including this (http://www.khronos.org/message_boards/v … ight=quads), that if you want to draw a quad in OpenGLES you have to use GL_TRIANGLES.
So I made something like this:
GLfloat vertices1[] = {v0,v1,v2};
…
glVertexPointer(3, GL_FLOAT, 0, vertices1);
glDrawArrays(GL_TRIANGLES, 0, 3);
…
GLfloat vertices2[] = {v1,v2,v3};
…
glVertexPointer(3, GL_FLOAT, 0, vertices2);
glDrawArrays(GL_TRIANGLES, 0, 3);
and the result is the same like if I do it with GL_QUADS.
My problem is that if I use other vertices order( eg: {v1,v2,v3} and {v3,v0,v1}) I have a different result.
So, using GL_TRIANGLES is not the same that using GL_QUADS.
Do you know if there is any other way to do this? or is the only way?
Thanks in advance,
Santiago Robles