i think you should do:
under linux and opengl and libfreenect
take the turns of your cube into a seperate functions aka:
// Called to draw scene
void RenderScene(void)
{
// Clear the window with current clearing color
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
// Save the matrix state and do the rotations
glPushMatrix();
// Move object back and do in place rotation
glTranslatef(0.0f, 0.0f, -5.0f);
glRotatef(xRot, 1.0f, 0.0f, 0.0f);
glRotatef(yRot, 0.0f, 1.0f, 0.0f);
glRotatef(zRot, 0.0f, 0.0f, 1.0f);
// Draw something --> this your cube drawing
gltDrawUnitAxes();
// Restore the matrix state
glPopMatrix();
// Buffer swap
glutSwapBuffers();
}
regards nomad

Find content
Not Telling