Forum > OpenGL

How to calculate which cube sides to cull?


I have all my cube faces sorted by (+X -X +Y -Y +Z -Z) in a single ibo and render them using glMultiDrawElements which allows me to select which sides to draw but I can't seem to find a way to select which faces I need.
The values involved should be the cameras position and viewing angle in combination with the chunks center position but how to calculate this exactly?
This would only need to work from outside the chunk but having something that works inside as well would be nice too.

The triangle winding order defines the front versus back face. The default is counter clockwise.
Here are a couple of Lazarus demos (meshProj_gl.lpi and cube_gl.lpi are the OpenGL variant, the other projects use Metal).



[0] Message Index

Go to full version