   Projection matrix - SOLVED
  Hello.I spent yesterday rewriting the material handling system for my renderer.This includes moving the parts setting world, view and projection matrices in my vertexshader. I rewrote the function, and ran it. Nothing showed up on screen. After some experimenting i noticed than when i try transposing the projection matrix i get one row of the rendered mesh repeated from the top to the bottom of the screen...I have no idea what causes this, as i haven't rewritten the shaders, or anything that calculates the matrices itself. It seems obvious I'm missing a step now i did before, but i can't figure out what it is.Hopefully, one of you will recognize the symptoms (the row repeat all over the screen) and be able to help me...If you need to see some code, just yell.[Edited by - tok_junior on December 13, 2005 3:15:30 AM]
  *Yell*   ;  Creating the projection-matrix, nothing changed here.HRESULT CD3D::CalcPerspProjMatrix(float p_FOV, float p_Aspect, D3DMATRIX* p_m){if(fabs(m_FarClip-m_NearClip)<0.01f)return E_FAIL;float l_sinFOV2=sinf(p_FOV/2);if(fabs(l_sinFOV2)<0.01f)return E_FAIL;float l_cosFOV2=cosf(p_FOV/2);float l_w=p_Aspect*(l_cosFOV2/l_sinFOV2);float l_h=1.0f*(l_cosFOV2/l_sinFOV2);float l_Q=m_FarClip/(m_FarClip-m_NearClip);memset(p_m,0,sizeof(D3DMATRIX));p_m->_11=l_w;p_m->_22=l_h;p_m->_33=l_Q;p_m->_34=1.0f;p_m->_43=-l_Q*m_NearClip;return S_OK;}Setting the constants. m_World and m_WorldView are just the matrices for transforming to world and view coordinates, respectively.No matter how much i compare this to the older version, I think it looks just the same.LPD3DXCONSTANTTABLE l_Table=m_VSConstants[m_CurrentVS];D3DXHANDLE l_ConstHandle;if(l_Table){l_ConstHandle=l_Table->GetConstantByName(NULL,"mWorld");if(l_ConstHandle){l_Table->SetMatrix(m_Device,l_ConstHandle,&D3DXMATRIX(m_World));}l_ConstHandle=l_Table->GetConstantByName(NULL,"mView");if(l_ConstHandle){l_Table->SetMatrix(m_Device,l_ConstHandle,&D3DXMATRIX(m_WorldView));}l_ConstHandle=l_Table->GetConstantByName(NULL,"mProject");if(l_ConstHandle){l_Table->SetMatrix(m_Device,l_ConstHandle,&D3DXMATRIX(m_WorldViewProj));}};  Ok, it works now.The error wasn't in the projection at all, but in the view-matrix, where I'd forgotten to initialize one element to 0.The only thing I'm wondering now is why it worked before :P   