Take the 2-minute tour ×
Game Development Stack Exchange is a question and answer site for professional and independent game developers. It's 100% free, no registration required.

I currently have volume data for the world stored as an array of booleans. I then check each empty block and if it has non-empty neighbors the faces get drawn. This prevents me from sending a bunch of faces to the graphics card using opengl.

I'm now working on inserting and removing blocks but I'm not sure how to do this quickly. It is simple enough to change the volume data but I don't want to recompute all the vertices from the volume data each time someone inserts or removes a block. It occurred to me just to add the block to the vertex buffer at the end of the existing vertex data but then I don't have a good way of destroying it as I have no way to correlate between the volume and vertex buffer data.

Any thoughts on how I can fix the mess I'm in?

share|improve this question
add comment

1 Answer

up vote 6 down vote accepted

Notch says:

Terrain is generated, saved and loaded, and (kind of) rendered in chunks of 16*16*128 blocks

Divide your world into small subsections of space. Within each of these sections, generate a VBO for the faces of the cubes (or place the faces into a big shared VBO). Each time you edit in a section, regenerate the VBO from scratch. This is unlikely to be a performance bottleneck.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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