So I’m debating this right now. Should I let OpenGL let its magic choose what face to cull, or should I use the normal to calculate if a face should be drawn.
Vertex Shader:
out bool shouldDraw;
void main(void) {
vec3 fdx = dFdx(pass_position);
vec3 fdy = dFdy(pass_position);
vec3 faceNormal = normalize(cross(fdx,fdy));
shouldDraw = dot(pass_surfaceNormal, faceNormal) > 0.0 // backface
}
and discard; any pixels with shouldDraw be to true
or
GL11.glEnable(GL11.GL_CULL_FACE);
GL11.glCulLFace(GL11.GL_BACK);
I find it awarding doing the first one because you can control cull settings in the shader when you have a transparent object. But there might be this large overhead due to me not knowing if OpenGL does some per-frame lengthy determination which might be true because of how it renders.