Archived

This topic is now archived and is closed to further replies.

mickey

hi, how do i solve this? 'Direct3D8: (ERROR) :Cannot invert projection matrix'

Recommended Posts

Direct3D8: (WARN) :Cannot compute WNear and WFar from the supplied projection matrix Direct3D8: (WARN) :Setting wNear to 0.0 and wFar to 1.0 Direct3D8: (ERROR) :Cannot invert projection matrix and i set it up like this, D3DXMATRIX mat; D3DXVECTOR3 vEye = D3DXVECTOR3( 0.0f, 0.0f, -30.0f ); D3DXVECTOR3 vAt = D3DXVECTOR3( 0.0f, 0.0f, 0.0f ); D3DXVECTOR3 vUp = D3DXVECTOR3( 0.0f, 1.0f, 0.0f ); D3DXMatrixLookAtLH( &mat, &vEye, &vAt, &vUp ); device->SetTransform( D3DTS_VIEW, &mat ); D3DXMatrixPerspectiveFovLH(&mat, D3DX_PI / 4, (float)(man->GetWindowWidth() / man->GetWindowHeight()), 0.0f, 100.0f); device->SetTransform( D3DTS_PROJECTION, &mat); and when i''m about to call drawpm, it breaks out, also, when i remove some dx debug, my code works though i get these nasty errors and warnings, what does that mean? many thanks,

Share this post


Link to post
Share on other sites
Can''t use 0.0f for the near value (2nd to last parameter in D3DXMatrixPerspectiveFovLH). I forget exactly why, but I believe it results in a divide by zero. Use 0.1f

Come join us on IRC in #directxdev @ irc.afternet.org

Share this post


Link to post
Share on other sites
ahh., many thanks! didin't thought of that,

sama thing with the eye vector of the camera, can't put in 0.0 for the z value., since i want my object upclose, my object z is 1.0 while i put my camera's z to 0.0 and it didn't worked too so i changed it to -0.1,

[edited by - mickey on July 18, 2002 9:35:48 AM]

Share this post


Link to post
Share on other sites
Guest Anonymous Poster
you should be able to put in 0.0 for the z of the eye.
the problem may have been that you set the near clipping distance at 1.0 which would have clipped out the object.
set near clipping to 0.1 and see if that works.
the camera (eye) should be able to go anywhere it wants. the near clipping plane however cannot be 0.0 though for mathematical reasons.

Share this post


Link to post
Share on other sites