Im trying to draw an object with multiple buffers, each with its own vao and ebo. OpenGL however only draws the first buffer and leaves the other 4. The code works by going through a for loop until each buffer has been called with glDrawElements, assigning the textures and binding the buffer and vao along the road.
Here's the relevant code: (written in c#)
for (int i = 0; i < Materials.Count; i++)
{
Materials[i].Texture.Use(GL_TEXTURE0);
Materials[i].SpecularMap.Use(GL_TEXTURE1);
glBindBuffer(GL_ARRAY_BUFFER, GeneratedBuffers[i]);
shader.SetFloat("material.shininess", Materials[i].Shininess);
shader.SetInt("material.diffuse", GL_TEXTURE0);
shader.SetInt("material.specular", GL_TEXTURE1);
shader.SetMatrix("model", Matrix.IdentityMatrix
* new Matrix(Scaling, translation)
* (MathC.GetRotationXMatrix(rotationX)
* MathC.GetRotationYMatrix(rotationY)
* MathC.GetRotationZMatrix(rotationZ)));
glBindVertexArray(GeneratedVAOs[i]);
glDrawElements(GL_TRIANGLES, indices[i].Count, GL_UNSIGNED_INT, (void*)0);
}
full file here:
https://github.com/Kawasss/CORERenderer/blob/prototype/CORE-Renderer/CORE-Renderer/Loaders/Obj.cs