PDA

View Full Version : VAO & VBO help!



allenmoatallen
02-03-2013, 01:34 AM
Hi guys,

This may sound like a stupid question, but here goes; I have a single VAO and single VBO in my renderer. Right now when I wish to draw my primitives I update the VBO data and push to the GPU for shaders.

Am I able to use only one VBO? It seems the only object that renders on the screen is the last update made to the VBO. This leads me to believe that I should have multiple VBOs.

Would it be best for me to create a new VBO whenever that data needs to be updated and then have the code check if that VBO exists already otherwise create a new one?

tonyo_au
02-03-2013, 03:50 PM
I depends on how you render objects. A draw call will render the current content of the vbo so if you use a sequence like

modify vbo
draw vbo
modify vbo
draw vbo
swap buffer

you will be able to draw 2 objects with one vbo.

Normally you use multiple vbo/vao sets. At least 1 for static objects and 1 for each object whose vertices you modify.

allenmoatallen
02-03-2013, 10:09 PM
We currently do handle rendering that way, update/draw all objects and then swap the buffers, however it doesn't seem to be behaving that way and only renders the last set of data sent.