# cannot see every face of cube while rotating

Hi guys ! I’m relatively new to openGL and today i tried to create a cube that spins. However, when i rotate it, i cannot see all it’s faces, but only a few. I figured out it’s something wrong with my camera or perspective. Here is the code i used:

glClearColor(255,255,255,255);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);

glMatrixMode(GL_PROJECTION);
gluPerspective(25,1,10,200);

glMatrixMode(GL_MODELVIEW);
gluLookAt(20,30,50,0,0,0,0,1,0);

glEnable(GL_DEPTH_TEST);
glCullFace(GL_BACK);
glEnable(GL_CULL_FACE);
glViewport(0,0,dim,dim);
glDepthFunc(GL_LEQUAL);

what should i add to see every face of the cube ?
The cube is drawn “by hand”, by calculating the new positions at every rotation:

struct Punct{
double x,y,z;
};

struct Cub{
Punct p[8];
};

Cub cube;
void rotatePoint(double &x,double &y,double angle){
double a,b;

a = x * cos(angle) - y * sin(angle);
b = y * cos(angle) + x * sin(angle);

x = a;
y = b;
}

void rotateCubeOX(double angle){
int i;
for( i = 0; i < 8; i++){
rotatePoint(cube.p[i].y,cube.p[i].z,angle);
}
}

void rotateCubeOY(double angle){
int i;
for( i = 0; i < 8; i++){
rotatePoint(cube.p[i].x,cube.p[i].z,angle);
}
}

void rotateCubeOZ(double angle){
int i;
for( i = 0; i < 8; i++){
rotatePoint(cube.p[i].x,cube.p[i].y,angle);
}
}

inline void Quad(GLdouble* v1,GLdouble* v2,GLdouble* v3,GLdouble* v4){
glVertex3dv(v1);
glVertex3dv(v2);
glVertex3dv(v3);
glVertex3dv(v4);
glEnd();
}

void deseneazaCub(){
double a[] = {cube.p[0].x,cube.p[0].y,cube.p[0].z};
double b[] = {cube.p[1].x,cube.p[1].y,cube.p[1].z};
double c[] = {cube.p[2].x,cube.p[2].y,cube.p[2].z};
double d[] = {cube.p[3].x,cube.p[3].y,cube.p[3].z};
double e[] = {cube.p[4].x,cube.p[4].y,cube.p[4].z};
double f[] = {cube.p[5].x,cube.p[5].y,cube.p[5].z};
double g[] = {cube.p[6].x,cube.p[6].y,cube.p[6].z};
double h[] = {cube.p[7].x,cube.p[7].y,cube.p[7].z};
glColor3f(1,0.1,0.1);