Original Post
I'm currently writing my own graphics engine, using Direct3D 9 and I've so far gotten it to load a mesh and textures and render them. But I'm having trouble with my camera class. Here is a screenshot of my engine loading room.x from the DirectX samples:
And I can move my camera left, but the perspective doesn't seem to change:
And when I move it further, then it gets these artifacts:
I have no idea why this error is happening. Here is the code for when I update the camera: From the last picture, the values of the variables are as follows: fFOV = 1.5707964 // In other words, D3DX_PI*0.5 fAspect = 1.3333334 fNearClip = 1.0 fFarClip = 1000.0 m_Position = { 1.0000001, 0.0, 0.0 } m_Target = { 0.0, 0.0, 60.0 } m_Up = { 0.0, 1.0, 0.0 } I have no clue why I'm getting these errors. Any help would be appreciated.
And I can move my camera left, but the perspective doesn't seem to change:
And when I move it further, then it gets these artifacts:
I have no idea why this error is happening. Here is the code for when I update the camera: void CDirect3D9Camera::Update(void *pData)
{
// View Matrix
D3DXMatrixPerspectiveLH(&m_ViewMatrix,
m_Setup.fFOV,
m_Setup.fAspect,
m_Setup.fNearClip,
m_Setup.fFarClip);
// Projection Matrix
D3DXMatrixLookAtLH(&m_ProjectionMatrix,
&D3DXVECTOR3(m_Position.x, m_Position.y, m_Position.z),
&D3DXVECTOR3(m_Target.x, m_Target.y, m_Target.z),
&D3DXVECTOR3(m_Up.x, m_Up.y, m_Up.z));
if (pData)
m_Setup.pDevice = (IDirect3DDevice9*)pData;
m_Setup.pDevice->SetTransform(D3DTS_VIEW, &m_ViewMatrix);
m_Setup.pDevice->SetTransform(D3DTS_PROJECTION, &m_ProjectionMatrix);
}