Archived

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

kapru

Finding 2d position

Recommended Posts

im trying to find the screen position of a vertex im using the following code D3DXMATRIX matView; D3DXMATRIX matProj; D3DXMATRIX matRes; D3DXMatrixLookAtLH(&matView,&camera.from,&camera.to,&camera.up); D3DXMatrixPerspectiveFovLH(&matProj,1.0f, 1.0f,0.10f, 100.0f); D3DXMatrixMultiply(&matRes,&matView,&matProj); D3DXVec3TransformCoord(&result,&VVerts.pos,&matRes); posx=(int)result.x; posy=(int)result.y; dosnt seem to work. if the vert is on the screen it returns 0,0 any help would be cool

Share this post


Link to post
Share on other sites
Ive now figured out that im using the wrong function here''s what im doing now

D3DXVec3Project(&result, &VVerts.pos, &vpScreen,&matProjection,&matView,&matWorld);

but it give screwed up results any one know ho o do this properly

Share this post


Link to post
Share on other sites