質問

I want to rotate and increase/decrease the scale of my cube. The rotate part is ok :

void spinCube(){
double theta=0;
theta+= 0.1;
if( theta > 360.0 ) 
   theta -= 360.0;
glRotatef(theta,1,2,6);
glutPostRedisplay();
}

And I call this function in main in glutDisplayFunc():

glutIdleFunc(spinCube);

Also, while my cube is rotating I want to increase and decrease the scale factor of my cube. I tried implementing this with the same way as rotation, for example:

void spinCube(){

double theta=0,x=0.1;
theta+= 0.1;
x+=0.1;
 if( theta > 360.0 ) 
    theta -= 360.0;
    if(x>4)
      x=0;
glScalef(x,x,x);
glRotatef(theta,1,2,6);
glutPostRedisplay();

}

but the cube is no longer drawn. Is there any solution to this problem?

役に立ちましたか?

解決

A Scaling of 0 is not valid. The correct value is 1 if you don't want to scale.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top