[QUOTE=Dark Photon;1248153]The gl*Pointer set of routines registers a data block which already contains the data for a vertex attribute. This can be a:
[ol]
[li]A CPU-pointer to a memory block in your application’s memory space (in the compatibility profile), OR
[/li][li]An offset into the VBO (vertex buffer object) bound to the GL_ARRAY_BUFFER bind point with glBindBuffer.
[/li][/ol]
If you choose option 2, then you need to have created, populated, and bound a buffer object already containing the data to the GL_ARRAY_BUFFER bind point. You’d create and populate it with glGenBuffers and glBufferData.
glVertexPointer = Register a data block to be read in the next Draw call for vertex position data (legacy attribute)
glColorPointer = Register a data block to read in the next Draw call for color value data (legacy attribute)
…
glVertexAttribPointer = Register a data block to be read in the next Draw call for generic vertex attribute #N
glGenBuffers = Create one or more buffer object handles
glBufferData = Allocate and fill the contents of a buffer object
glBufferSubData = Fill the contents of a buffer object (no allocation)[/QUOTE]
Let me just say an example for you to see if i got this right…
Let’s say I have 2 arrays, one of the color, and the other of the vertex. When I use the glBufferData I’ll need to set it’s size with at least color.length + vertex.length, right?
After that I can use glBufferSubData to fill my buffer with tha color and vertex data.
And the last thing, if i got this right, I’ll need to set the pointer to the color and vertex… If both arrays have 20 of length and I added first the 20 vertex and affter the 20 color, I could use it like this:
void glVertexPointer(vertex.length, GL_FLOAT, 0, BUFFER_OFFSET(0));
void glColorPointer(color.length, GL_FLOAT, 0, BUFFER_OFFSET(20));
What do you say? Am I in the right way?