198 CHAPTER 6: Will It Blend?^
glColorPointer(4, GL_UNSIGNED_BYTE, 0, m_ColorData);
[self multiTextureBumpMap:m_BumpMapInfo.name tex1:m_TextureInfo.name];
glDrawArrays(GL_TRIANGLE_STRIP, 0, (m_Slices+1)*2*(m_Stacks-1)+2);
return true;
}
Make sure to copy over multiTextureBumpMap() from the previous exercise to Planet.m.
Now go to where you initialize the lights in your solar-system controller, and comment
out the call to create the specular material. Bump mapping and specular reflections
don’t get along too well.
And to your solar-system’s controller replace its current execute() and executePlanet()
methods with listing 6-9. This dumps the sun, moves the earth into the center of things,
and places the main light off to the left.
Listing 6-9. The New Execute Routine that Places the Earth in the Center
-(void)execute
{
GLfloat posFill1[]={-8.0,0.0,5.0,1.0};
GLfloat cyan[]={0.0,1.0,1.0,1.0};
static GLfloat angle=0.0;
GLfloat orbitalIncrement=.5;
GLfloat sunPos[4]={0.0,0.0,0.0,1.0};
glLightfv(SS_FILLLIGHT1,GL_POSITION,posFill1);
glEnable(GL_DEPTH_TEST);
glClearColor(0.0, 0.25f, 0.35f, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
glPushMatrix();
glTranslatef(-m_Eyeposition[X_VALUE],-m_Eyeposition[Y_VALUE],-
m_Eyeposition[Z_VALUE]);
glLightfv(SS_SUNLIGHT,GL_POSITION,sunPos);
glEnable(SS_FILLLIGHT1);
glDisable(SS_FILLLIGHT2);
glPushMatrix();
angle+=orbitalIncrement;
[self executePlanet:m_Earth];
glPopMatrix();
glPopMatrix();
}