hello.
I have a simple project that creates some vertex buffer , then bind them to a shader that does the render of the buffers.
I see in some application that i find in google that the vertex buffers are deleted after the drawing.
Why?
if i must render a teapot why i must delete and recreate the vbos every cicle of drawing?
Is possible to store the vbo and reuse it?
and for shaders and textures ?
the same question
thanks.
vbo and delete
You don't have to delete and recreate resources every frame. If some tutorial does, you should stay away from it, but chances are also that you have misunderstood the code and what's happening.
Yup; if someone's doing glGenBuffers/draw stuff/glDeleteBuffers everytime they draw anything, the reason why is because they have no idea of how to use the API properly.
Are you sure they're deleting the actual VBO and not just the client-side array containing the data?
Are you sure they're deleting the actual VBO and not just the client-side array containing the data?
Even if so, they shouldn't be doing it at runtime.
Even if so, they shouldn't be doing it at runtime.
Sure, there's no need recreating a vbo over and over. But where's the problem deleting the array once the vbo is set up?
[quote name='mhagain' timestamp='1345141289' post='4970282']
Even if so, they shouldn't be doing it at runtime.
Sure, there's no need recreating a vbo over and over. But where's the problem deleting the array once the vbo is set up?
[/quote]
I agree. Why would you keep two versions of the same data(one in system memory, other in video memory)? It's the same for textures. You will be needing the data if you plan to animate though.
If you can animate in a shader, you should - it'll run faster and you won't need to re-up verts.
You're right though; if the code that the OP sourced from is just deleting a system memory copy after creating the VBO then it's OK (although you may want to keep it around if you ever need to recreate the VBO - e.g. on a video mode change - not totally necessary though), but without seeing the actual code it's stretching thing a little to assume that it's just doing this, especially going off the OP's description ("the vertex buffers are deleted after the drawing"). Again, without seeing the code, etc...
You're right though; if the code that the OP sourced from is just deleting a system memory copy after creating the VBO then it's OK (although you may want to keep it around if you ever need to recreate the VBO - e.g. on a video mode change - not totally necessary though), but without seeing the actual code it's stretching thing a little to assume that it's just doing this, especially going off the OP's description ("the vertex buffers are deleted after the drawing"). Again, without seeing the code, etc...
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement