Search code examples
androidopengl-es-2.0vbovertex-buffer

OpenGL ES : Understanding Vertex Buffer Objects


I am working on an Android project a bit like Minecraft. I am finding this a great way to learn about OpenGL Performance.

I have moved over to a vertex buffer object which has given me huge performance gains but now I am seeing the down sides.

I am right in thinking I need a vertex buffer object per:

  1. Different mesh
  2. Different texture
  3. Different colour

Am I also right in thinking that every time the player adds a cube I need to add that on to the end of the VBO and every time the user removes a cube I need to regenerate the VBO?

I can't see how you could map a object with properties to its place in the VBO.

Does anyone know if Minecraft type games use VBO's


Solution

  • Yeah if you malloc() a memory space then you need to create new VBO-s. If you want to expand it because you need more memory. If you want to show less then I guess you could play with IBO-s but again you have to rearrange the VBO at some point.

    I'm not really sure what you mean by object properties but if you want them to be shown then I think you'll need different VBO-s for each kind of property/cube-type / shader pairs. And draw them in groups.

    If you want to store other kind of properties then you shouldn't store it in VBO that you pass to OpenGL.

    I have no idea what Minecraft uses but my best advice is that you store the not likely to reach cubes in VBO-s and the the likely to use cubes in easy to modify container. (I don't know if it would help or not)