I'm making a cube-world-game like Minecraft. And to render it I've splitted it in 16x16x16 blocks regions (also known as chunks in mc) and then, on rendering, I take all the chunks in the rendering distance area and foreach of them I iterate all blocks and draw them.

It's so slow.

Then I tryed to remove hidden blocks and draw only visible faces of blocks. I made a VBO that store a face and then using model matrix I rotate it to make the other sides of the block. Finally I added a camera frustum test that checks if the block is visible from the camera.

I didn't code yet all these things, that's just a reasoning.

Are these optimization good or could I add something else?

P.S: I've seen that minecraft use a "display list" foreach chunk and not use a VBO for a face (I've didn't understand the code well since part of it is obfuscated) and each loop get just the rendering distance chunks and draw them using the display list stored. How's possible making a display list with all the shape of the chunk? There's another thing that does the same thing of the display list but it's not deprecated (I though VBO but I'm not sure)?

  • 2
    \$\begingroup\$ Don't do what Minecraft did. \$\endgroup\$
    – Bálint
    Commented Jan 29, 2017 at 18:04
  • \$\begingroup\$ Store all chunk vertices in one vbo per chunk? Why not? \$\endgroup\$
    – loryruta
    Commented Jan 29, 2017 at 19:28
  • \$\begingroup\$ @loryuta 1: It's terribly slow, changing VBO data takes a long time, 2.: There are way better alternatives, such as indexing. \$\endgroup\$
    – Bálint
    Commented Jan 29, 2017 at 20:45
  • \$\begingroup\$ Could you explain it better, please? \$\endgroup\$
    – loryruta
    Commented Jan 29, 2017 at 21:56

1 Answer 1


Basically what you said above answers your question...

Split the world into "chunks," and only load these when the player is within a certain distance. Minecraft has that useful "Render Distance" setting. Yes, use VBOs. They can be optimized. Make sure to use shaders, rather than inline quads and alike. Make sure to cull faces than aren't visible. Assuming you're using OpenGL as you're renderer, I'd suggest building your project with version 3.0 minimum, 3.2 or 3.3 preferred, with compatibility profile or core profile. If you use the compatibility profile, you may notice a performance drop, as noted by Quentin.

Check out https://www.khronos.org/opengl/wiki/Core_And_Compatibility_in_Contexts for more information on that.

  • \$\begingroup\$ Is there maybe a way to encapsulate the data of a chunk in one single vbo and then render directly it? \$\endgroup\$
    – loryruta
    Commented Jan 29, 2017 at 11:00
  • \$\begingroup\$ You can! VBOs are basically arrays of data, storing your vertices, colors, etc... The purpose is to store your data before rendering, so the application doesn't have to generate your stuff each frame. You're going to want to use VAOs too, which essentially wrap all your VBOs, so you don't have to manage individual ones. This is a huge performance boost. \$\endgroup\$ Commented Jan 29, 2017 at 14:19
  • \$\begingroup\$ Two great resources: khronos.org/opengl/wiki/… (you should read the whole wiki) and antongerdelan.net/opengl/vertexbuffers.html \$\endgroup\$ Commented Jan 29, 2017 at 14:21
  • \$\begingroup\$ Re: "core backwards capabilities" -- It's not clear whether you mean the core profile or the compatibility profile. \$\endgroup\$
    – Quentin
    Commented Jan 31, 2017 at 11:10
  • \$\begingroup\$ @Quentin Fixed the typo, thank you for pointing it out. \$\endgroup\$ Commented Jan 31, 2017 at 13:22

Not the answer you're looking for? Browse other questions tagged .