I'm trying to set up Direct X 11 and I have a cube that I'm trying to render multiple times in different places. The problem is only the last one being drawn gets rendered.
Here is how I set my constant buffers
struct objData
{
Matrix4x4 world;
Matrix4x4 viewProj;
};
// I do this for every object
void CRenderer::setPerObjectData( const Matrix4x4& world,const Matrix4x4& viewProj )
{
D3D11* d3d = g_Engine->getD3D();
objData d = { world,viewProj };
D3D11_MAPPED_SUBRESOURCE edit;
d3d->getDeviceContext()->Map(_pObjectData, 0, D3D11_MAP_WRITE_DISCARD, 0, &edit);
memcpy(edit.pData, &d, sizeof( objData ) );
d3d->getDeviceContext()->Unmap(_pObjectData, 0);
// '_pObjectData' is the same buffer for all the objects being rendered
d3d->getDeviceContext()->VSSetConstantBuffers(0, 1, &_pObjectData);
}