A Question about Vertex Buffer

Started by
3 comments, last by CoreWill 20 years, 7 months ago
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!
------------------------------The Great Nature!
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.
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
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.
------------------------------The Great Nature!
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]
----Erzengel des Lichtes光の大天使Archangel of LightEverything has a use. You must know that use, and when to properly use the effects.♀≈♂?
Thank you for your reply!!!
------------------------------The Great Nature!

This topic is closed to new replies.

Advertisement