CHAPTER 5: Textures (^165)
glColorPointer(4, GL_UNSIGNED_BYTE, 0, m_ColorData);
glDrawArrays(GL_TRIANGLE_STRIP, 0, (m_Slices+1)2(m_Stacks-1)+2);
glDisable(GL_BLEND);
glDisable(GL_TEXTURE_2D);
glDisableClientState(GL_TEXTURE_COORD_ARRAY);
return true;
}
The main difference here is the addition of code to enable texturing, to set the current
texture, and to hand off the pointer to OpenGL.
Compile and run, and ideally you’ll see something like Figure 5-22.
Figure 5-22. Sun and Earth
If you examine the actual artwork used for this exercise, you’ll notice that it is fairly
bright but low in contrast. The main reason is that the real oceans are actually quite dark
and it just did not look right under the lighting condition.
singke
(singke)
#1