Sign in to follow this  

How to move objects created with a vertex buffer

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

This topic is 4482 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this