Jump to content
  • Advertisement
Sign in to follow this  
EnlightenedOne

Projection Matrix issue cannot compute WNear and WFar (Fixed)

This topic is 3254 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 recently turned on the debugger for DX and have got three issues that are slowing to crippling my progress :p When I ran my game I had afew redundant render issues because of a multiple particle systems being drawn one after the other being allocated the same texture multiple times aside from that the only trouble I had was the issue below. Direct3D9: (WARN) :Cannot compute WNear and WFar from the supplied projection matrix Any clue whats wrong with the matrix below? _D3DMATRIX 2.4142134 0.00000000 0.00000000 0.00000000 0.00000000 2.4142134 0.00000000 0.00000000 0.00000000 0.00000000 1.0000000 -0.00000000 0.00000000 0.00000000 1.0000000 0.00000000 Anyone who can tell me how to supply the near and far planes for culling will get a nice rating boost :) [Edited by - EnlightenedOne on October 26, 2009 5:53:38 PM]

Share this post


Link to post
Share on other sites
Advertisement
Heres my start code for rendering where the issue takes place.



void StartRender(float x, float y, int renderMode)
{
d3ddev->Clear(0, NULL, D3DCLEAR_TARGET , D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->Clear(0, NULL, D3DCLEAR_ZBUFFER, D3DCOLOR_XRGB(0, 0, 0), 1.0f, 0);
d3ddev->BeginScene();
d3dspt->Begin(D3DXSPRITE_ALPHABLEND);

if (renderMode == 0)
{
D3DXMATRIX matView; // the view transform matrix
D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3 (x +20, y +20, 1550.0f), // the camera position (512.0f, 384.0f, 1550.0f)
&D3DXVECTOR3 (x +20, y +20, 0.0f), // the look-at position
&D3DXVECTOR3 (0.0f, -1.0f, 0.0f)); // the up direction
d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the view transform to matView
}
else if(renderMode == 1)
{
D3DXMATRIX matView; // the view transform matrix
D3DXMatrixLookAtLH(&matView,
&D3DXVECTOR3 (2048, 1536, 5050.0f), // the camera position (512.0f, 384.0f, 1550.0f)
&D3DXVECTOR3 (2048, 1536, 0.0f), // the look-at position
&D3DXVECTOR3 (0.0f, -1.0f, 0.0f)); // the up direction
d3ddev->SetTransform(D3DTS_VIEW, &matView); // set the view transform to matView
}

D3DXMATRIX matProjection; // the projection transform matrix
D3DXMatrixPerspectiveFovLH(&matProjection,
D3DXToRadian(45), // the horizontal field of view
1024 / 768, // the aspect ratio
0.0f, // the near view-plane
100.0f); // the far view-plane
d3ddev->SetTransform(D3DTS_PROJECTION, &matProjection); // set the projection */




I need to compare this to other fragments of code and see if theres a more refined or elaborate way of putting this all together

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.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!