Jump to content
  • Advertisement


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


of vertex buffers and world matrices

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

I''m just starting direct3d and I am having trouble figuring out the relationship between a vertex buffer and a world transform matrix. If I have a list of vertices, do I have to manually retranslate them all each frame? Or do I leave the vertex buffer alone and tell direct3d to use my world matrix (updated each frame) to translate the scene? If so, how do I specify which world matrix to use for which set of vertices? Thanks for any insight.

Share this post

Link to post
Share on other sites
Leave the vertex buffers alone as much as you can. The fewer variables you have to change, the faster your code will run. Supposedly locking/unlocking buffers takes a significant overhead also.

The three main matricies (World, View, Projection) are applied to the vertices as they are processed inside the DrawPrimitive function. So if you set the World transform, do a DrawPrimitive, change the World Transform, and draw a second Primitive, you transform the first primitive with the first matrix and the second primitive with the second matrix.

Remember that the transforms are variables stored in the Device object (until the device is lost or released), so you can theoretically leave them (like the projection transform) alone after you create the device.

Also, remember that you can use small bits of one vertexbuffer in separate DrawPrimitive calls. I.E. put two objects with compatible vertex formats inside one vertexbuffer, then call DrawPrimitive(TriangleList, 0, 5); and DrawPrimitive(TriangleList, 5, 5);

[edited by - Nypyren on July 4, 2003 4:13:40 AM]

Share this post

Link to post
Share on other sites

  • Advertisement

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!