• Advertisement

Archived

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

A Question about Vertex Buffer

This topic is 5288 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 am a beginner with Direct3D, and I have a question about Vertex Buffer: Should I create a Vertex Buffer when I render a frame every time, Or Create a Vertex Buffer big enough only one time? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
Create it the first time it''s needed. Delete it when it''s not needed anymore. Store it in between frames. Do NOT delete and recreate every frame, that will slow you down... alot.

Share this post


Link to post
Share on other sites
I cannot undertand it clearly, could you please explain "Delete it when it''s not needed anymore" in detail, giving me a example is better.
i don''t know when it''s not needed.
thanks.

Share this post


Link to post
Share on other sites
When you're done with it. Like when you have no instances of the buffer left, or at the end of the program.
For example, you create a buffer for your object, load the vertices into the buffer, and save that as a member variable. When, in the game, the object is destroyed, you delete that vertex buffer. Or, like me, you create a vertex buffer for each type of object, for example I could have 12 box objects that have the same vertex buffer. Once all 12 of them have been destroyed, I delete the buffer. Usually you create a manager to hold the buffers and to know how many objects are using each buffer, and when the number using it is 0 it deletes it. If you then create another object after all have been destroyed you'd have to recreate it, but that's better than creating a new one for each object. Or you could just keep everything loaded until the end of the program and then delete it to avoid what I mentioned, but use up more memory.

[edited by - Erzengeldeslichtes on September 1, 2003 1:48:34 AM]

Share this post


Link to post
Share on other sites

  • Advertisement