Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

Is there a special order in which vertices are entered into a vertex array? Currently I'm drawing single textures like this:

glBindTexture(GL_TEXTURE_2D, texName);
glVertexPointer(2, GL_FLOAT, 0, vertices);
glTexCoordPointer(2, GL_FLOAT, 0, coordinates);
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);

where vertices has four "xy pairs". This is working fine.

As a test I doubled the sizes of the vertices and coordinates arrays and changed the last line above to:

glDrawArrays(GL_TRIANGLE_STRIP, 0, 8);

since vertices now contains eight "xy pairs". I do see two textures (the second is intentionally offset from the first). However the textures are now distorted. I've tried passing GL_TRIANGLES to glDrawArrays instead of GL_TRIANGLE_STRIP but this doesn't work either. I'm so new to OpenGL that I thought it's best to just ask here :-)


share|improve this question
Define distorted? Are you trying to draw two separate quads on the screen and seeing triangles from the first to the second quad due to the tri-stripping? –  Roger Perkins Jan 12 '11 at 17:51
Thanks for the response. Yes I'm trying to draw two separate quads. I've read a bit more and it sounds like I should use GL_TRIANGLES instead of GL_TRIANGLE_STRIPS. When I use GL_TRIANGLES the distortion I see looks kinda like the first star is being folded over on itself while the second star is kinda stretched "out of the screen" (my game is 2D btw). –  MrDatabase Jan 12 '11 at 17:58

1 Answer 1

up vote 3 down vote accepted

You've got the two quads joined by the tri-strip. You could either do two separate glDrawArrays with the first being (0,4) and the 2nd being (4,4) to split the two quads up, or as you say, do triangles instead.

If you switch to triangles then you'll need to either duplicate up vertices, or if you use indices to index, you'll need to specify the 3 corners of each triangle.

Tri-strips work by taking the first 2 vertices specified then draw a triangle to the 3rd. Subsequently every extra vertex results in another triangle where it makes a triangle using the last 2 vertices and the new vertex. Some platforms support providing an index value allowing you to "reset" the tri-strip and effectively allowing you to split a sequence into multiple tri-strips with a single call.

share|improve this answer
Awesome thanks for the response! Using GL_TRIANGLES and duplicating the vertices worked. I also referenced this SO question: stackoverflow.com/questions/4319073/… –  MrDatabase Jan 12 '11 at 18:11

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.