first thing: old style openGL? please look into upgrading
second create a cubeAngle
variable
in your update function increment it with how fast you want to rotate (multiplied by the delay between updates) only if flag==0
then
glPushMatrix();
glTranslatef(20,5,-10);
glRotatef(cubeAngle, 0.8f, 1.0f, 0.5f);
drawCube();
glPopMatrix();