Contents
How to define input layout when using more than one vertex buffer?
Merge your two input layout structures into one structure, and your HLSL vertex shaders into one shader. The InputSlot field member of D3D11_INPUT_ELEMENT_DESC will determine which vertex buffer is used for that element.
Can you store vertex attribute data in multiple Vbos?
There’s also nothing stopping you from storing the vertex attribute data for multiple batches inside a single VBO or set of VBOs. The optimal layout depends on the specific GPU and driver (plus OpenGL implementation), but there are some things that are just generally good ideas.
What should the vertex format be in OpenGL?
The optimal layout depends on the specific GPU and driver (plus OpenGL implementation), but there are some things that are just generally good ideas. When rendering multiple different meshes, try to organize your data so that as many meshes as possible reside in the same buffer object with the same vertex format.
What’s the best way to rearrange vertex data?
A time-tested alternative is to use normalized GLshorts. To do this, you rearrange your model space data so that all positions are packed in a [-1, 1] box around the origin. You do that by finding the min/max values in XYZ among all positions.
Can you have more than one input layout in HLSL?
You can only have one input layout and one vertex shader set on the device context at one time. Each time you call IASetInputLayout and VSSetShader the previous layout/shader is replaced with the new one. Merge your two input layout structures into one structure, and your HLSL vertex shaders into one shader.
How to draw triangle with one vertex shader?
To experiment, I started from a MSDN tutorial that just draw a single triangle with just one vertex shader. I splitted the shader into 2 parts, position and color. Hereafter are the main lines of my HLSL and C++ code. I also tried to define the layout element into a single array, in two different slots, but it didn’t work either.
How to determine which vertex buffer is used in D3D11?
The InputSlot field member of D3D11_INPUT_ELEMENT_DESC will determine which vertex buffer is used for that element. Thanks for contributing an answer to Stack Overflow! Please be sure to answer the question.