I'm making a Minecraft like game using OpenGL and I wonder, what is the best solution to make a flexible rendering without perfomance loss. I mean there are different types of blocks with different ways of drawing: usual blocks are just simple cubes with textures, stairs are more complex and liquid blocks like water and lava need texture update. I have a chunk with display list. Every block has it's own type (byte value). According to this value I can find "full" block representation (it is common for all blocks of same type and contains name, draw method and additional info). Now I need to remove rendering invisible faces (if block has a neighbour at the left, we don't need to draw it's left face). But it means I need to pass 6 arguments to the drawing method (or an array, or a mask). Is it a good way of drawing, or I have choosen a dumb solution? What can you recommend for drawing different types of blocks in it's own way?
for(int x = 0; x < 16; x++){
for(int y = 0; y < 128; y++){
for(int z = 0; z < 16; z++){
GL11.glPushMatrix();
GL11.glTranslatef(x, y, z);
BlockTypes.getBlockType(blocks[x][y][z].type).draw();
GL11.glPopMatrix();
}
}
}