Jump to content
  • Advertisement
Sign in to follow this  
FireSoul

How to move objects created with a vertex buffer

This topic is 4701 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, whats the best method of changing the vertex co-ordinates of objects created using CreateVertexBuffer(...) and rendering using: SetStreamSource() SetFVF() SetTexture() DrawPrimitive() Given that the createvertexbuffer is called when loading, how do you change the coordinates of the vertices stored in the vertex buffer each frame, before rendering. Thanks for any help.

Share this post


Link to post
Share on other sites
Advertisement
It depends on exactly what you mean by "change coordinates". Do you want to simply change all of the coordinates, like a translation (ie, I want to move the object to [100,50,250])? In that case, you should use matrices. Create your appropriate transformation matrix using the D3DXMatrix*() series of functions, then enable it with IDirect3DDevice9::SetMatrix(). If you haven't used matrices before, you definetly need to look them up to see how they apply to 3D graphics.

If you want to move individual vertices, you need to lock the vertex buffer, edit the appropriate vertices, and unlock.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!