Skip to main content
gamedev.net
🔒 Locked

extracting a vertex buffer

Started by MrOffRoad Aug 15, 2003 at 5:04 PM 1 replies 300+ views
Original Post
MrOffRoad
MrOffRoad
having real trouble with getting vertex buffers from meshes. I''m using a LPD3DXMESH and D3DXLoadMeshFromX to load a landscape from a .x file. The file has been converted from a simple landscape in 3ds max. Having loaded the file I can render it with no problems. However, I need to get access to all the data in order to do collision detection so I''ve tried using m_pMesh->GetVertexBuffer( &pVB ); pVB->Lock( 0, 0, (void**)&m_pVertices, 0 ); so I lock the vertex buffer and put it into a vertex array. I''m not getting the correct data in m_pVertices as I don''t think I have the correct FVF and don''t know how to find it out. what I really need is an array of vertices(xyz) in an order I can work with. Is there an easy way to do this? I don''t really want to be locking and unlocking the vertex buffer during run time either... Please help
RenderTarget
RenderTarget
m_pMesh->GetFVF();

If you''re using x files and D3DXMeshes, you''ll have to lock the VB to get the data. There''s not much choice there.

I like pie.
[sub]My spoon is too big.[/sub]
MrOffRoad
MrOffRoad
thanks for the tip,

I''ve used CloneMeshFVF to force the mesh into my FVF format and I seem to have some better data coming from that. There are a lot of mesh functions there to play with

I think I can lock the vertex buffer putting the data in pVertices then unlock the VB and work with pVertices normally.

I''ll get there in the end



Topic Locked

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

Sign in to reply to this topic.