I'm trying to use GLM with Direct3D11 to write a cross platform wrapper for graphics APIs. I ran into a problem though, because when I use the XNA math functions to create a view matrix and a projection matrix, it works fine and everything renders properly. However, when I use the GLM perspective and lookat methods using the same parameters I can't see anything on my screen at all.
For example: this call works
XMMatrixPerspectiveFovLH( XM_PIDIV2, 1024.0f/768.0f, 0.01f, 100.0f );
But this call doesn't
glm::perspective(core::MathUtils::pi/2, 1024.0f/768.0f, 0.01f, 100.0f);
This call works:
XMVECTOR Eye = XMVectorSet( 0.0f, 1.0f, -5.0f, 0.0f );
XMVECTOR At = XMVectorSet( 0.0f, 1.0f, 0.0f, 0.0f );
XMVECTOR Up = XMVectorSet( 0.0f, 1.0f, 0.0f, 0.0f );
cb.m_view = XMMatrixTranspose(XMMatrixLookAtLH( Eye, At, Up ));
But this one doesn't
glm::vec3 eye(0.0f, 1.0f, 5.0f);
glm::vec3 at(0.0f, 1.0f, 0.0f);
glm::vec3 up(0.0f, 1.0f, 0.0f);
m_driver->setViewMatrix(glm::lookAt(eye, at, up));
I've already checked to see if I was just setting the matrices wrong when I pass them to the shader, but my world matrix gets passed along just fine.