• ### Announcements

#### Archived

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

# How do I get the coordinates of an object?

## Recommended Posts

After useing ID3DXBaseMesh::GetIndexBuffer and ID3DXBaseMesh::GetVertexBuffer, then how do i get the coordinates of the object (x, y, z, tu, tv).

##### Share on other sites
U make the coordinates for it. It doesnt just pop up anywhere

##### Share on other sites
To start, you need an appropriate VERTEX structure for the FVF format of your mesh. Then you can, for example, do:
struct VERTEX{    float x, y, z;    float tu, tv;// Possibly other stuff -- see GetFVF on BaseMesh, I think};VERTEX *pv = (VERTEX *) LockMeshVertexBuffer(...);WORD *pi = (WORD *) LockMeshIndexBuffer(...);// First point on the objectfloat x = pv[pi[0]].x;// And so on

I believe objects are stored as triangle lists.

• ### Forum Statistics

• Total Topics
627704
• Total Posts
2978716

• 21
• 14
• 12
• 10
• 12