Okay…so like everybody else, I’m trying to create a “simple” voxel engine.
I’m trying to create a VBO that will draw the entire chunk of 16x16x16 cubes.
My questions are:
-
FloatBuffer vertexData = BufferUtils.createFloatBuffer(294912);
Is the above code bad? it’s got 161616*72 slots available for the vertex buffer which means it can store every vertex of every cube.
Should I be storing this many floats in the same buffer? (it’s my understanding that VBO’s are to Immediate mode as the GPU is to the CPU) which would mean that
what I’m doing is correct. -
what does glGenBuffers() actually do, and when should it be called?
before the vertices are stored in the float buffer? while they’re being stored? after they’re stored? etc. -
what actually happens to the FloatBuffer when it is flipped?
should it only be flipped once (always)? -
what does the following code do?
int vboVertexHandle = glGenBuffers();
glBindBuffer(GL_ARRAY_BUFFER, vboVertexHandle);
glBufferData(GL_ARRAY_BUFFER, vertexData, GL_STATIC_DRAW);
glBindBuffer(GL_ARRAY_BUFFER, 0);
Any information on any of the above questions would be much appreciated!
*as always, any source code will be supplied upon request
Thanks!
QuicK