I'm trying cull away every face, if it's normal has an angle of: 90 < x < 270 (degrees) with the vector from cameraPosition to vertexPosition.
Everything I see is the screen turning black. I just started with GLSL so I don't know what the reason could be... Or how to debug.
Vertex Shader:
uniform vec3 camera_Position;
void main(void)
{
vec4 vertex_Position = gl_ModelViewProjectionMatrix * gl_Vertex;
vec3 N = gl_Normal.xyz;
vec3 V = camera_Position - vertex_Position;
float angle = degrees(acos(dot(N,V)));
if(angle >= 90) {
return;
}
if(angle <= 270) {
return;
}
gl_Position = vertex_Position;
}
Fragment Shader:
void main()
{
gl_FragColor = gl_Color;
}