0
votes

So I'm trying to implement VBOs but I can't find a good tutorial or documentation of the proper usage of them. I'm guessing you make a VBO when some object needs it and then when the next frame comes about it's drawn/redrawn. But here is where I'm confused:

  • How do I draw multiple VBOs?
  • How do I modify a VBO?
  • When and where do I make a new VBO?

I'm really sorry and I'm just learning OpenGL so excuse me for that! But it's hard to find a tutorial that doesn't just make one VBO, and doesn't make that VBO at the same time it's drawn.

Mainly what I'm asking for is a better understanding of how VBOs work, where they are stored, and how they are drawn. How many VBOs is too many? When I call glVertexPointer() what exactly happens with stored VBOs? What if I'm trying to draw VBOs of different types? (just use triangles?)

1

1 Answers

0
votes

How do I draw multiple VBOs?

VBOs are data storage, just like textures. There's a function called glBindBuffer which binds a VBO for subsequent access through glVertexAttribPointer.

How do I modify a VBO?

glBufferSubData

or

buf = glMapBuffer(...);
modify_on(buf);
glUnmapBuffer(...);

When and where do I make a new VBO?

Whenever the existing VBOs no longer can satisfy your demands. Either because they're to small, full or don't match your data type.