#### Archived

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

# weird return of D3DXVec3Project()?

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

## 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 on other sites
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 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 on other sites
yes, you''re right, that''s not strange at all. Thanks anyway.

1. 1
2. 2
Rutin
19
3. 3
khawk
18
4. 4
5. 5
A4L
11

• 9
• 12
• 16
• 26
• 10
• ### Forum Statistics

• Total Topics
633768
• Total Posts
3013753
×