locked
How to Bind Multiple Shapes/Models to One Vertex Buffer?

    Question

  • If I have two Vertex Arrays, one for Square, and one for Triangle; what is the best way to bind them to the VertexBuffer?

    1. Is this possible with objects that have different numbers of Vertices?
    2. 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);


    Monday, January 28, 2013 10:09 PM

Answers

  • check this http://gamedev.stackexchange.com/questions/48291/how-to-bind-multiple-shapes-models-to-one-vertex-buffer 

    NEU_ShieldEdge

    Wednesday, January 30, 2013 8:55 AM

All replies

  • check this http://gamedev.stackexchange.com/questions/48291/how-to-bind-multiple-shapes-models-to-one-vertex-buffer 

    NEU_ShieldEdge

    Wednesday, January 30, 2013 8:55 AM
  • Hi,

    I saw you solve this issue in the link, I will close this thread.

    Best regards,
    Jesse


    Jesse Jiang
    MSDN Community Support | Feedback to us
    Develop and promote your apps in Windows Store
    Please remember to mark the replies as answers if they help and unmark them if they provide no help.

    Monday, February 04, 2013 2:31 AM
    Moderator