PDA

View Full Version : glColorPointer and glDrawArrays(GL_TRIANGLE_STRIP



Nacho4d
06-30-2010, 08:09 PM
Hi,
This is my first post,
I am trying to render a surface using


glVertexPointer(3, GL_FLOAT, 0, gridVerticesStrip);
glColorPointer(4, GL_FLOAT, 0, gridColors);
glDrawArrays(GL_TRIANGLE_STRIP, 0, gridVerticesStripLength);


I wonder if I have to arrange colors inside gridColors the same order as gridVerticesStrip (when using GL_TRIANGLE_STRIP) or is ok if I just put them like when rendering using GL_TRIANGLES

Above code is very simplified, but I am rendering a large surface so I have a for loop doing glDrawArrays and I wonder If I have to do the same with colors?.

Thanks.

Dark Photon
07-01-2010, 05:38 AM
I wonder if I have to arrange colors inside gridColors the same order as gridVerticesStrip (when using GL_TRIANGLE_STRIP) or is ok if I just put them like when rendering using GL_TRIANGLES
The former.

The issue is all enabled vertex arrays are going to be "looked up" by the same draw call, and each draw call has one primitive type. So they all need to follow the same convention.