I'm trying to create a vertex buffer and I can't figure out what I'm doing wrong.
The particle struture looks like this:
struct ParticleVertex12
{
float x;
float y;
float z;
};
And here's my code for creating a buffer:
ID3D11Buffer* mVertexBuffer;
D3D11_BUFFER_DESC desc;
memset( &desc, 0, sizeof( desc ) );
desc.BindFlags = D3D11_BIND_VERTEX_BUFFER;
desc.Usage = D3D11_USAGE_DYNAMIC;
desc.ByteWidth = sizeof(ParticleVertex12) * NR_OF_PARTICLES;
HRESULT hr = S_OK;
hr = device->CreateBuffer( &desc, nullptr, &mVertexBuffer );
return hr;
NR_OF_PARTICLES == 1000 and device->CreateBuffer returns E_FAIL. Any suggestions?
You can't create a Dynamic Buffer without CPU Access Flags otherwise there's no way to populate it with data.