Reputation: 2650
I am working on implementing a directx11 instance of our game engine and I am a newbie in 3d game programming.
I know a little about DirectX11 graphics pipeline and shaders and what vertex buffers, input layout, etc are.
While looking at the one of the APIs the code is something like:
glBindVertexArray(current_vao);
glBindBuffer(GL_ARRAY_BUFFER, current_vbo);
glBufferData(GL_ARRAY_BUFFER, sizeof(Vector3) * Vertices.size(), &Vertices.front(), GL_DYNAMIC_DRAW);
glEnableVertexAttribArray(0);
glVertexAttribPointer(0, 3, GL_FLOAT, GL_FALSE, sizeof(Vector3), reinterpret_cast<void*>(0));
glDisableVertexAttribArray(1);
glDisableVertexAttribArray(2);
glDisableVertexAttribArray(3);
glDisableVertexAttribArray(4);
glDisableVertexAttribArray(5);
glDisableVertexAttribArray(6);
glBindBuffer(GL_ARRAY_BUFFER, 0);
What is this VAO
and VBO
equivalent in DirectX11
? What exactly is this code doing ?
Upvotes: 2
Views: 2051
Reputation: 41067
A "VBO" is just a vertex buffer, which in DirectX 11 is a ID3D11Buffer
with a bind flag of D3D11_BIND_VERTEX_BUFFER
which contains the vertex data.
There is no direct equivalent to the OpenGL "Vertex Attribute Array". In DirectX 11, you just submit a distinct Draw
for each group of like state settings (a.k.a material attribute).
If you are complete new to DirectX 11, you might consider working through the [DirectX Tool Kit tutorials.
Upvotes: 1