Jump to content
  • Advertisement

Archived

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

Khanh

weird return of D3DXVec3Project()?

This topic is 5476 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

hello everyone, I would like to get screen coordinates from a 3D point by D3DXVec3Project() and it resulted very strange : totally outside of screen. Let me report my status : D3DXVECTOR3 vPos=(0,0,0) Viewport = {0, 0, 500, 500, 0.0f, 1.0f} View matrix: D3DXMatrixLookAtLH( &matView, &D3DXVECTOR3( 0.0f, -8.0f,-10.0f ), &D3DXVECTOR3( 0.0f, -10.0f, 0.0f ), &D3DXVECTOR3( 0.0f, 1.0f, 0.0f ) ) World Matrix: Identity Projection: D3DXMatrixPerspectiveFovLH( &matProj, D3DX_PI/2, 1.0f, 1.0f, 100.0f ); Result: x=250.000, y=-47.6190 Any help please? Thanks in advance Khanh

Share this post


Link to post
Share on other sites
Advertisement
It is not that wierd i think.

You are looking from (0,-10,0) and your point is at (0,0,0).
If your point is at 0,-10,0 the return value should be (250,250) since you your point is at 0,0,0 your y-value is smaller than 250.

be yourself.

Share this post


Link to post
Share on other sites
If the point is at 0,-10, 0 the return value cannot be calculated at all due do an division by zero.

However you are right, this isn''t weird at all. You can easily find points which are projected outside of the screen.

Share this post


Link to post
Share on other sites

  • 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!