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:

            BufferUtils.createFloatBuffer(32 * 32 * 256 * 6 * 6 * 5),

I map them once at creation:

            32 * 32 * 256 * 6 * 6 * 5 * 4,

Then I can write directly into the buffer and make changes visible to the GPU with:


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

  • \$\begingroup\$ why did you assume that Minecraft's use Display Lists? \$\endgroup\$ – concept3d Mar 18 '14 at 22:05
  • \$\begingroup\$ I took a look at the source code. \$\endgroup\$ – Toun Mar 18 '14 at 22:23
  • 2
    \$\begingroup\$ I suspect it is the 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\$ – bcrist Mar 19 '14 at 2:48
  • \$\begingroup\$ I tried without persistent mapping and I got no performance increase. Also, my game would be very resource demanding so I assume players will have very recent graphics cards, or at least OpenGL 4.4 capable. \$\endgroup\$ – Toun Mar 19 '14 at 11:09
  • \$\begingroup\$ @Toun - AMD don't support GL4.4 at all - you can't make that assumption. \$\endgroup\$ – Maximus Minimus Mar 19 '14 at 21:16

If you don't do any optimization you are rendering up to ~half a billion vertices, you can:

Remove faces/vertices where blocks touch, and don't issue draw calls for chunks that lay outside of the FOV.

Beyond that you can do more advanced vismap approaches, and merge faces when possible.

If you still think there is something wrong, i suggest you edit your post with some more code, rather then just the buffer initializations.

  • \$\begingroup\$ Ok I'll edit my post. \$\endgroup\$ – Toun Mar 20 '14 at 6:50

I finally implemented a display list version and now I get nearly 3000 constant FPS, which is excellent I think. I didn't change the number of vertices nor the number of chunks (I already did a face selection when tesselating the chunks).

Like @bcrist said, the persistant mapping may have killed the performance.

Display lists are also far more easier to use than VBO's, as I don't even need to manually allocate memory, and they don't require the latest unsupported OpenGL versions.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.