Quantcast
Channel: GameDev.net
Viewing all articles
Browse latest Browse all 17825

Multiple vertex buffers and Input slots Question

$
0
0
EDIT: I have now solved my problem after trail and error Hi All, I'm following Frank Luna's book, Introduction to 3D Game Programming with Directx 12, and have come to the point where there is an exercise to create a cube using 2 Vertex buffers; one for position, and one for color. I'm then supposed to bind these to different Input slots(0 and 1). All is fine except my color data seems to be misinterpreted by the pipeline, no matter what color I specify to the vertices in my buffer, the cube will still be rendered as a predetermined assortment of colors. Am I missing anything important to achieving this goal? these are the steps I took so far: Used Two vertex buffers to feed pipeline with vertices struct VPosData {XMFLOAT3 Pos; }; struct VColorData {XMFLOAT4 Color; }; Changed INPUT_ELEMENT_DESC accordingly mInputLayout = { { "POSITION", 0, DXGI_FORMAT_R32G32B32_FLOAT, 0, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 }, { "COLOR", 0, DXGI_FORMAT_R32G32B32A32_FLOAT, 1, 0, D3D12_INPUT_CLASSIFICATION_PER_VERTEX_DATA, 0 } }; Bound the two vertex buffers to the input slots mCommandList->IASetVertexBuffers(0, 1, &mBoxGeo->VertexBufferView()); //Input Slot 0 for verts mCommandList->IASetVertexBuffers(1, 1, &mBoxGeo->VertexBufferView()); //Input Slot 1 for Color The Textbook doesn't specify any extra steps to achieve this result, so at this point I'm not sure how to go about debugging this problem. Any feedback would be appreciated.

Viewing all articles
Browse latest Browse all 17825

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>