• Advertisement


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

accessing mesh details (dx8) - help

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

hi there, I am trying to access the vertex/uv/face/material information that is loaded with the D3DXLoadMeshFromX( command from directx 8. I know generally that I need to lock the buffers to get any info out and have used num_vertex:=loadedmesh.GetNumVertices; num_faces:=loadedmesh.GetNumFaces; to get the number of vertexes/faces etc. I also know it hinges on loadedmesh.GetVertexBuffer(vb); etc, but I am having terrible trouble getting any further. I am coding in delphi 5 with the directx 8 sdk. I can load/display etc, but really want to access the actual mesh details. Anyone know how to acieve this? James

Share this post

Link to post
Share on other sites
I haven''t actually done this but this should work:

Assuming you have

vb_array : array[suitable size] of TCustomVertex
vb : The actual vertex buffer
pt : PByte pointer

vb.Lock(.., pt, ..)

Locks the vertex buffer... pt now points to the start of the buffer.

Move(vb_array, pt, number_of_bytes) // or something like that

move the data that pt shows to into your vb_array

now you can manipulate it and then (if necessary) copy the results back.

Don''t forget to unlock!!



PVB : Pointer to Array of TCustomVertex

vb.Lock(.., pt, ..);
PVB := pt;

now you can use PVB as if it was your array of vertex data.

Again... don''t forget to unlock afterwards.


Share this post

Link to post
Share on other sites

  • Advertisement