I am using the LWJGL and drawing cubes with glBegin/glEnd, but I heard this method is very inefficient and I should start using VBOs. I have no idea how that works.
I want to draw cubes of different sizes and positions (no rotation), and I think I should use VBOs for this.
Can anyone could give me some example code or insight on how to use VBOs with Java or even if VBOs are the best choice?
This is the code I wrote to test VBOs with Java. It uses JOGL instead of LWJGL, but that’s a minor thing.
In addition to glVertexPointer you can also use glTexCoordPointer and glNormalPointer to specify data for texture coordinates and normals and enable them with glEnableClientState(GL.GL_TEXTURE_COORD_ARRAY) and glEnableClientState(GL.GL_NORMAL_ARRAY).