I have made a stack of cubes each one high with dimensions 50xAxis 50zAxis stacked 5 high (yAxis). However when I rotate the whole thing with the mouse and view it from the sides and underneath I can see through to the other side with rather unaesthetic results.
I have tried to find a solution but I can’t figure out the problem. Any help would be much appreciated.
I have tried to following but it has drastic consequences. The whole image suddenly looks like its made out of sand with no solid sufaces just dots of colour.
Here are some screenshots. One from the front which is fine then one from the side where you can see through the layers of cubes, and one from underneath where you can see through to the top.
I don’t know why it started working. But i think what was going on, were the normals of the face having an inverted direction.
Example: If you placed the camera inside the cube you would not see any of the walls because the inside faces are not being rendered. OpenGl is under the impression that the inside faces are the out side faces. (atleast on the bottum face)
Anyway, to fix the normals, reverse the order in which you order the verticesfor the buttom face. Or simply tell OpenGl to render both sides using the obove call.