I am making this program that needs to render colored quads. I am using VBOs for this.
This is how I store the data for the vertices and the colors:
render quad:
buff.put(3 floats color)
render the quad (3 floats per vertex * 4 per face * 6 per quad)
Now as you see my aim is to use interleaved VBOs but I cant figure out the stride and offset.
Here are my calls when rendering:
(Note im using mapped vbos thats why there is no actual data binding):
glBindBufferARB(GL_ARRAY_BUFFER_ARB, etn.getVboHandel());
glBufferDataARB(GL_ARRAY_BUFFER_ARB, etn.getVboData().capacity() << 2, GL_STATIC_DRAW_ARB);
glColorPointer(3, GL_FLOAT, /* stride **/6 << 2, /* offset **/0);
glVertexPointer(3, GL_FLOAT, /* stride **/6 << 2, /* offset **/0);
glDrawArrays(GL_QUADS, 0, etn.getVboData().capacity());
I cant get the offset and stride to be correct so when I render I see this weird artifacts..