VBO Problems :(

Hello,

I am trying to migrate my Immediete mode code to VBOs. I am following a youtube tutorial, but when I try and render bad things happen. Strange colors, crazy vertexes, I can’t figure it out.

If you could point me the right way that would be awesome! Here is my rendering code: http://pastebin.java-gaming.org/65f02934f2419

Thanks!

In your call to glDrawArrays, what does the value (4 * 6 * 4) mean?

The rest looks fine, make sure Shape.createCubeVertices builds the vertices correctly.

The source is here: https://github.com/BiggerOnTheInsideTeam/Binder-Development

For some reason it doesnt even show up right, just some strange colors. If you would take a look at the source. The 4 * whatever is the color size, it was in the tutorial…

I see what the 4 * 6 * 4 comes from.

4 vertices per quad * 6 faces * 4 bytes for floats

Looking at the LWJGL wiki (http://wiki.lwjgl.org/wiki/Using_Vertex_Buffer_Objects_(VBO)), you enable the states before using the bind/pointer commands.

Ah yeah, you must enable the client states before using the bind functions.
Secondly, the third parameter of glDrawArrays takes the number of indices, aka: number of vertices, so it should be 4 * 6.