Skip to main content
gamedev.net
๐Ÿ”’ Locked

Finding 2d position

Started by kapru Aug 11, 2003 at 3:40 AM 0 replies 350+ views
Original Post
kapru
kapru
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
kapru
kapru
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.