Hi I've been trying to implement my own math library for use with DirectX11 and I've run into trouble creating the constant buffer.
My data to be sent to the constant buffer looks like this
Hi I've been trying to implement my own math library for use with DirectX11 and I've run into trouble creating the constant buffer.
My data to be sent to the constant buffer looks like this
Create your device with the D3D11_CREATE_DEVICE_DEBUG and check your Output window in Visual Studio, it will have error messages telling you what the problem is. My guess would be that you're creating your constant buffer buffer using sizeof(cbPerObject), and it's failing because the size isn't a multiple of 16 bytes (which is a requirement for constant buffers). There's 3 easy ways to fix that:
1. Pad your struct to the next multiple of 16 bytes
2. Use __declspec(align(16)) to force the compiler to pad the size to 16 bytes
3. Round up the size when creating the constant buffer by doing (sizeof(cbPerObject) + 15) / 16