Voxel engine optimalisation

Hi all,

For the last few days I have worked on my first OpenGL test project. It's a simple voxel engine in Java with the LWJGL library. I used chunks, just like Minecraft. Those chunks are 16*16*128. When I load the world, I loop over all the blocks in a chunk, creating a VBO with the coordinates, normal coordinates and texture coordinates of every single chunk. Now, when I render 1 chunk of 16*16*128, I get around 250 FPS (Yes, this renders actually all the cubes inside the chunk so 16*16*128 = 32768 quads). However, when I try to render 4 chunks, it already dropped to 40 FPS. What would be the best way to increase my FPS?

For the last few days I have worked on my first OpenGL test project. It's a simple voxel engine in Java with the LWJGL library. I used chunks, just like Minecraft. Those chunks are 16*16*128. When I load the world, I loop over all the blocks in a chunk, creating a VBO with the coordinates, normal coordinates and texture coordinates of every single chunk. Now, when I render 1 chunk of 16*16*128, I get around 250 FPS (Yes, this renders actually all the cubes inside the chunk so 16*16*128 = 32768 quads). However, when I try to render 4 chunks, it already dropped to 40 FPS. What would be the best way to increase my FPS?

Thanks!

You should use a transformation phase. Transform from a chunk data into a list of visible surfaces. For example, it is no use to draw quads from cubes facing in a direction where there is another solid material.

Getting a good FPS from voxel based data is a challenge. You are going to need a lot of optimization and special hacks, depending on the number of chunks you want to show.

However, I get a triangle on the z axis (pointing towards me), and the texture coordinates aren't working. Anything wrong with the float array or drawing code? Quads work fine. What could be the problem here?

glNormalPointer(GL_FLOAT, 24, 0); << missing first parameter..
and - looks like you are missing the propper offset and stride for the glNormalPointer, glTexCoordPointer they are not starting with the 1 elementin your buffer data. so the last parameter needs to be 24, and 48 i would guss ..

Is seems that I actually am not missing an argument in glNormalPointer, as this works fine with quads. Also, could you explain how the last parameter works? (pointer_buffer_offset). I still can't get it to work properly.