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 want to know what technique will give me most fps in game. I have minecraft-like world and I need to display it. Now I have only one cube, created as VBO and if i need to display cube I just display it. But now I want to know what will be faster:

Create for each cube type VBO (even for each side of it) or to create new VBO each frame for whole mesh to display?

I am very new to subject so if there are other faster techniques let me know. Thanks in advance.

share|improve this question

1 Answer 1

up vote 3 down vote accepted

This is not a simple question - but the philosophy is simple - seek out like things and bundle them together so that the pipeline never starves for data nor stops to change gears.

Secondly, do NOT create the same thing again and again - if you have a cube, build the vertex buffer and index buffer once - use instancing, and use the world matrix to change location, size, and orientation of the cube.

If you have many cubes that never move, then preprocess them to incorporate their position in the world into their vertices proper - i.e., you are changing from project*camera*world to just project*camera

If you have many cubes that all have the same texture or material, consider bundling them all up into one vertex buffer - course this is assuming you're never going to fiddle with the geometry

Use constant buffers whenever you can - organize things so they change only when they have to - never load them with the same data all over again - sort things so that like comes through the pipeline with like

At the end of the day, your final techniques will likely be tuned to the nature of your application - you'll do what you need to do to keep those pipes flowing in the gpu as efficiently as possible

share|improve this answer
    
Thanks for answer, but it a little vague. I have only cubes to display. But I want to do culling based on connection between cubes. For example if cube (x, y, z) have neighbour at (x+1, y , z) I don't want to display its right side. So I'll be (1)forced to change index buffer everytime and push it to graphic card for each cube or (2)create 6 index buffers one for each side but do up to 6 drawing calls for each side or most hardcore(3) create 2^6 (64 - all permutations of visible) index buffers and do one call for each side. Seems like 3rd one is best optimization, but I need aprove to start it –  user2349668 May 17 '13 at 18:38
    
You would only need to update the index buffer if you are updating the block. When the block changes, update the Vertex and Index buffer, send it to the card, then forget it until one of those two blocks (or ideally, any block in that chunk) is updated again. –  Phil May 17 '13 at 23:39

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.