I was looking at the tutorials in DirectX SDK. Tutorial 5 works fine, but after I have copied and separated the code to my own classes, I got strange error during launching my application.
The line is:
g_World1 = XMMatrixIdentity();
Because of it, I got error in xnamathmatrix.int operator= which looks like that:
XMFINLINE _XMMATRIX& _XMMATRIX::operator=
(
CONST _XMMATRIX& M
)
{
r[0] = M.r[0];
r[1] = M.r[1];
r[2] = M.r[2];
r[3] = M.r[3];
return *this;
}
And the error message is:
Access violation reading location 0xffffffff
I have read somewhere that it could be caused by something connected to XMFLOAT4X4 / XMMATRIX:
Have you considered using XMFLOAT4X4 to store the matrix, and only using XMMATRIX?
But I think I already use XMMATRIX.
MyClass.h:
private:
XMMATRIX g_World1;
MyClass.cpp:
void init(){
g_World1 = XMMatrixIdentity();
}
I don't think I should change XMMATRIX g_World1; to XMFLOAT4X4 g_World1, because it produces errors like:
error C2679: binary '=' : no operator found which takes a right-hand operand of type 'XMMATRIX' (or there is no acceptable conversion)