Jump to content
  • Advertisement
Sign in to follow this  
BlueJester

OpenGL [SOLVED] World View Projection Matrix weirdness

This topic is 3844 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have a weird problem with the world view projection matrix. It seems to project the objects 90% correctly, but I have been trying to do some procedural geometry lately and have been having problems with the UVs being correct. I took a look at what was happening in PIX and it looks as if it is not rotating objects correctly, it is basically projecting through objects. I am not sure exactly what could be wrong here: D3DXMatrixLookAtRH((D3DXMATRIX*)&m_ViewMat, (D3DXVECTOR3*)eye, (D3DXVECTOR3*)lookAt, (D3DXVECTOR3*)up); m_pD3DDevice->SetTransform( D3DTS_VIEW, (D3DXMATRIX*)&m_ViewMat); D3DXMatrixPerspectiveFovRH((D3DXMATRIX*)&m_ProjMat, GETRAD(m_fFOV), m_fAspectRatio, m_fPerspectiveMin, m_fPerspectiveMax); m_pD3DDevice->SetTransform(D3DTS_PROJECTION, (D3DXMATRIX*)&m_ProjMat); These are the exact calls I am making to setup the view and projection matrices. I am using RH on purpose :) The world space matrix I am setting via: m_pMatrixStack->Push(); m_pMatrixStack->MultMatrix((D3DXMATRIX*)mat); m_pD3DDevice->SetTransform(D3DTS_WORLDMATRIX(0), m_pMatrixStack->GetTop()); but using the identity matrix does not change anything, so I think I can rule this out as a possible problem. Is this projection correct? This problem happens in both OpenGL and DirectX as near as I can tell, PIX verifies this in DirectX but I do not know of something like PIX in OpenGL to try this out, the resultant problem is the same. To me it should have rotated the point to not be directly in front of its local space position, but on the opposite side. Here is a sample of the problem: http://i278.photobucket.com/albums/kk112/TheBlueJester/oddWVP.jpg Thanks in advance

Share this post


Link to post
Share on other sites
Advertisement
Of course this always happens when I post things... I thought i tested this but the problem was indeed using Right Hand rotation... using left hand rotation fixes the problem. Anyway, glad I figured this out for me, if anyone has any questions, please reply :)

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!