Jump to content
  • Advertisement

Archived

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

chris1234

vertexbuffer....

This topic is 6053 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 making a 2D game seen from above so all my objects are use a textured rectangle. The rectangle is made of 2 triangles that are stored in a vertexbuffer. I used to have 1 vertexbuffer for each object. I changed that so now I only have 1 vertex buffer. so now I rotate, move all my objects in there own structure and before drawing the primitives I copy the transformed rectangle from it''s object to the vertexbuffer then draw the primitive and then move on to the next object. this makes the code cleaner, keeps the directx8 stuff out of my object class, but is this wise to do? use 1 vertexbuffer for all my rectangles? it works perfectly...but if it''s slower or very unwise to do I don''t know....so any comment would be appreciated Chris

Share this post


Link to post
Share on other sites
Advertisement
Using just one vertex buffer should be much faster than using many, because it takes (a lot of) time to switch between vertex buffers. The only reason you might need multiple vertex buffers is if you have so many vertices that they won''t all fit in one buffer, but that is very unlikely to happen.

Keep doing what you''re doing.

Also, try to minimize texture changes, by grouping objects that use the same texture. If you have a lot of small textures, you could also consider combining them into one larger texture so that you don''t have to set the texture so often.

If you''re using triangle strips for your quads, you might want to consider using triangle lists (and possibly index buffers) instead so that you can pass all quads that use the same texture with one Draw[Indexed]Primitive call instead of several calls.

Locking vertex buffers is also expensive, so if you''re not already doing this, you should probably copy all the new vertex information in one block so you don''t keep locking and unlocking the vertex buffer.

John B

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.

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!