I'm making a voxel rendering engine. My "chunks" are 32 * 32 * 256 blocks and I can render a 16 * 16 square of them (which corresponds to Minecraft's maximal render distance). I'm using VBOs holding XYZ float
positions and UV float coordinates. I use one VBO per chunk.
VBOs are alloacted with:
GL44.glBufferStorage(GL15.GL_ARRAY_BUFFER,
BufferUtils.createFloatBuffer(32 * 32 * 256 * 6 * 6 * 5),
GL30.GL_MAP_WRITE_BIT | GL44.GL_MAP_PERSISTENT_BIT);
I map them once at creation:
GL30.glMapBufferRange(GL15.GL_ARRAY_BUFFER,
0,
32 * 32 * 256 * 6 * 6 * 5 * 4,
GL30.GL_MAP_WRITE_BIT | GL30.GL_MAP_UNSYNCHRONIZED_BIT | GL44.GL_MAP_PERSISTENT_BIT, null);
Then I can write directly into the buffer and make changes visible to the GPU with:
GL42.glMemoryBarrier(GL44.GL_CLIENT_MAPPED_BUFFER_BARRIER_BIT);
This works, except I get about 20 FPS, while Minecraft gets 300 without frustum culling. The CPU is clearly not the bottleneck, as I have 1M FPS when the window is minimized.
Am I doing something wrong or are VBOs slower than Minecraft's Display Lists? How can I speed this up?
System specs: i7 4770 & GTX 770 OC
GL_MAP_PERSISTENT_BIT
that is destroying your performance. On an unrelated note, I hope you have fallbacks for when those GL4 features are unavailable, otherwise a large number of computers will choke and die with your engine, including about 95% of laptops by my estimation. \$\endgroup\$