locked
Re-Loading The Buffer After Initialization

    Question

  • I have a model that ultimately renders a triangle list. The initial rendering works fine, however, I was wondering - if I want to adjust the triangle position, what is the correct approach to do it, so that I can clear the device buffer, set the new vertex and index buffers and the re-render?

    Basically, my model class has an Initialize method, that creates the rectangles. Once completed, I call device->CreateBuffer for both vertex and index buffers. After that, I am rendering the content in a RenderBuffers method, with:

    deviceContext->IASetVertexBuffers(0,1,&m_vertexBuffer,&stride,&offset);

    deviceContext->IASetIndexBuffer(m_indexBuffer,DXGI_FORMAT_R32_UINT,0);

    deviceContext->IASetPrimitiveTopology(D3D11_PRIMITIVE_TOPOLOGY_TRIANGLELIST);



    Friday, June 08, 2012 8:56 PM

All replies

  • Why not create two buffer first?

    NEU_ShieldEdge

    Monday, June 11, 2012 11:18 AM
  • Hello ddelimarsky,

    Are you still having problems with this or do you have what you need? If you still need help please let me know and I will do what I can to help you.

    Thanks,

    James


    Windows Media SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Saturday, June 16, 2012 12:27 AM
    Moderator
  • Out of curiosity, what would be the right way to have two swappable buffers in this case, that can be easily integrated in an existing swap chain?

    Monday, June 18, 2012 3:03 PM