Original Post
I'm trying to implement back-face culling. The problem is that the object flickers all the time when I rotate the object. I'm rotating the camera vector when I rotate the object. Then I use the dot product of that camera vector with the polygon's normal to be able to determine if I need to draw the polygon or not. The thing is that it seems to work fine if I don't rotate the camera vector, so I think that the rotation is wrong. This is how I rotate the camera vector: Does anyone know a solution to my problem?
// Setup camera location
gluLookAt(0,0,60,0,0,0,0,1,0);
camera.x = 0;
camera.y = 0;
camera.z = 60;
// Rotate camera vector around Y-axis
int x = camera.x, z = camera.z;
camera.x = x * cos(angle)+ z * sin(angle);
camera.z = z * cos(angle)- x * sin(angle);
// Rotate and draw the object
glRotatef(angle,0,1,0);
DrawObject();