OpenGL VAO and D3D11 input layout

Hi everyone,

I was wondering about the differences between direct3D 11 and OpenGL 3.3 with respect to how generic vertex attributes are specified.

As far as I understand, for D3D there’s the concept of an input layout, which specifies for each generic attribute, its format and the binding point of the buffer that provides it.

In OpenGL, the VAO state specifies both how to read a generic attribute from a buffer AND the buffer itself, grouping together two different things.

If that is correct, in d3d I could use the same input layout for all the shaders that share the same input signature (assuming all the buffers I use to store vertex data are organized the same way), while using Ogl, I’d need a different VAO for each set of vertex buffers that I’ll use to provide vertex attributes for a draw call, even if I’m always using the same shader.

Is this correct? Is there a way to replicate the d3d logic in OpenGL 3.3? is it possible with the latest OpenGL version?


Use separate attribute formats. This splits the functions into two groups of functions: vertex format setting and buffer setting. They are still technically setting values to the same object, but there’s no reason why you can’t share VAOs while still changing buffers as needed.