Let's imagine a scene composed by 3 objects (2 boxes and a plane). These 3 meshes are stored within a unique Vertex Buffer Object (VBO) as follow:
VBO(id = 1) {[Box_1_vertex][Box_2_vertex][Box_3_vertex]}
I currently use a specific Index Buffer Object (IBO) to manage the indexation of the vertices of each mesh of my scene as follow:
IBO(id = 2) {Box_1_index}
IBO(id = 3) {Box_2_index}
IBO(id = 4) {Box_3_index}
So, to render my scene I need a unique binding call for my vertex buffer and 3 binding calls for index buffer as follow:
VBO(id = 1)->Bind()
{
FOR_EACH(IBO in IBO_LIST(size = 3))
{
(*IBO)->Bind();
{
glDrawElements(...);
}
}
}
So I wonder if it's possible to store all the indices (Box_1_index + Box_2_index + Box_3_index) in a unique IBO (like for the VBO) and use rather than the function glBindBuffer but this time the function glBindBufferRange to focus on my IBO data ?
This way I will have the following pattern of code:
VBO(id = 1)->Bind()
{
IBO(id = 2)->Bind();
{
glDrawElements(...);
}
}
But according to the official OpenGL documentation the first parameter of the function 'glBindBufferRange' can be GL_TRANSFORM_FEEDBACK_BUFFER or GL_UNIFORM_BUFFER but not GL_ELEMENT_ARRAY_BUFFER (I currently use this one to bind an IBO).
So, is it possible to bind a specific segment of data contained within a specific IBO using the function 'glBindBufferRange'?