So can someone tell me why this works:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (int i = 0; i < text.size(); i++) {
loader.getByFloat(i).bind();
glBindBuffer(GL_ARRAY_BUFFER, text.get(i));
glVertexPointer(3, GL_FLOAT, 0, 0);
glBindBuffer(GL_ARRAY_BUFFER, texture);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
glDrawArrays(GL_QUADS, 0, 24 * (chunkWidth * chunkHeight * chunkDepth));
}
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
This works but is very very inefficient.
Any why this does not:
glEnableClientState(GL_VERTEX_ARRAY);
glEnableClientState(GL_TEXTURE_COORD_ARRAY);
for (int i = 0; i < text.size(); i++) {
loader.getByFloat(i).bind();
glBindBuffer(GL_ARRAY_BUFFER, text.get(i));
glVertexPointer(3, GL_FLOAT, 0, 0);
}
glBindBuffer(GL_ARRAY_BUFFER, texture);
glTexCoordPointer(2, GL_FLOAT, 0, 0);
glDrawArrays(GL_QUADS, 0, 24 * (chunkWidth * chunkHeight * chunkDepth));
glDisableClientState(GL_VERTEX_ARRAY);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
So I set up my program to run off of arrays, to allow easy modifying and texture changing, so I want the program to iterate through all of the VBO handles that I have, then bind the texture that matches it, then bind it, and repeat. When its done, it should draw the array. That is what my second code should do, but it doesnt show anything. Can anyone tell me why?