If I have two Vertex Arrays, one for Square, and one for Triangle; what is the best way to bind them to the VertexBuffer?
- Is this possible with objects that have different numbers of Vertices?
- Is this possible with objects that have different buffer element descriptions, (one with float4 position data, and another with float3 and texcoords, etc).
I have about 100 static model templates that I would like to bind to the vertex buffer, and a few thousand instances associated with those models in an instance buffer.
I can DrawInstanced/Indexed and point to the appropriate pointer in the vertex buffer for reading, (I think), so I am just trying to figure out the best way to get the vertices into the vertex buffer in the first place.
Thanks!
Currently, I am binding one Shape, (a triangle), to the subresource like this:
ModelRenderer::StaticBufferDescription.ByteWidth = bufferSize;
ModelRenderer::StaticBufferDescription.BindFlags = D3D11_BIND_VERTEX_BUFFER;
ModelRenderer::StaticSubResourceData.SysMemPitch = 0;
ModelRenderer::StaticSubResourceData.SysMemSlicePitch = 0;
ModelRenderer::StaticSubResourceData.pSysMem = model->GetVertices();
DeviceManager::Device->CreateBuffer(
& ModelRenderer::StaticBufferDescription,
& ModelRenderer::StaticSubResourceData,
& ModelRenderer::StaticBuffer);