I'm making a Minecraft like game and I would like to apply some optimizations. Firstly I didn't and I rendered the world using a vbo in which I stored a cube model and I drow all blocks of the worlds and off course it caused lag if there were too many blocks. Then I decided to draw the world face-by-face and check if a face is hidden from another one.
This concept is simple if I have the world made only by cubes of the same size, like this: Blue and black block are two blocks of the same size and the red face is the face to ignore since is hidden (overlapped) by another opaque face.
As I said if I want to make blocks of different sizes (scale)/position/rotation but by always drawing them from faces, the matter is different since I can't know if a face is completely visible or not. Here's an image of a normal block with a "custom" block on it:
Here the rotation is null but if there's no way to check rotated faces I can simply ignore it and draws all rotated blocks by default (I don't rotate all the world lol)... that's not what I'd like to do but if there's no way or the way is too difficult...
Anyway, finally, how can I check (using GL functions or doing it in my code) if a face is hidden and to ignore it on rendering?
I forgot to say that another optimization I did is if a block is hidden (has a block relative to each face) by other blocks I don't draw it.