CHAPTER 6: Will It Blend? (^199)
-(void)executePlanet:(Planet *)planet
{
GLfloat posX, posY, posZ;
static GLfloat angle=0.0;
glPushMatrix();
[planet getPositionX:&posX Y:&posY Z:&posZ];
glTranslatef(posX,posY,posZ);
glRotatef(angle,0.0,1.0,0.0);
[planet execute];
glPopMatrix();
angle+=.4;
}
If you now see something like Figure 6-17, you may officially pat yourself on the back.
Figure 6-17. The bumpy Earth
OK, now for an experiment. Move the light’s position so that it comes in from the right
instead of the left. Figure 6-18 is the unexpected result. What’s going on here? Now the
mountains look like valleys.
singke
(singke)
#1