r/opengl•
Modi57

Best practices regarding VBOs

So I was doing some prodding around in OpenGL after some time, and I think VAOs, VBOs and their relation to each other finally somewhat clicked for me. I still see multiple ways to achieve the same thing though, and wanted to ask some clarifying questions.

Lets say, I want to render a 3D-scene with multiple objects, that should each have their own transform, and have just two vertex attributes. A 3D coordinate and a texture/UV coordinate. To get those on the screen, I would go through each object, load the data from disc somehow and create it's own VAO. Then I have 3 options for the different vertex attributes.

  1. I create two VBOs, one for the 3D coordinates, one for the UV coordinates. I make the vertex attributes point at the beginning of the respective buffer and set the stride to the width of one element.

  2. I create one VBO and interleave the data. I point one vertex attribute at the beginning of the buffer and the other offset by the size of one element of the first element.

  3. I create one VBO and batch the data. I point one vertex attribute at the beginning of the buffer with the stride set to one element of the attribute, and the other attribute is offset by the whole width of the first batch, with the stride set to the width of the second attribute.

From the point of the shader, all three approaches look exactly the same, so are there any practical differences and is there a preferred way?

I would also like to have some confirmation if my use of one VAO per visible object is correct. Thank you for your time and have a nice day :)

Posted Apr 8, 2026, 1:04 PM UTC

1517
Loading comments…