Each chunk is loaded into one large VBO. (empty space in the VBO is all zeros)
According to my understanding of textures and VBOs, multiple textures have to be rendered as such:
glBindTexture(GL_TEXTURE_2D,texture1);
glDrawArrays(GL_TRIANGLES, offset1,size1);
glBindTexture(GL_TEXTURE_2D,texture2);
glDrawArrays(GL_TRIANGLES, offset2,size2);
SDL_GL_SwapBuffers();
This is an issue for me because the information has to be loaded into the VBO with its chunk group, and in order to fit the scheme above I would need to break apart each chunk and keep track of where all the individual triangles are for when the chunk needs to be unloaded.
To me that is extremely messy and I would probably kill myself if i actually had to code it.
Is there any other way to do VBOs with multiple textures? Or do all the triangles have to be ordered in the VBO by which texture they use like in the code snip?
Also if you have an answer please expand more than just saying "use texture arrays" or something like that. OpenGL has far too poor of documentation to just google that sort of thing.
Thanks.