CHAPTER 4: Turning On the Lights (^111)
glMaterialfv(GL_FRONT_AND_BACK, GL_EMISSION, yellow);
Because the yellow is at full intensity, what do you expect to see? Probably Figure 4-
11a. Next cut the values down by half so you have this:
GLfloat yellow[]={.5,.5,0.0,1.0};
Now what do you see? I’ll bet it looks something like Figure 4-11 (right).
Figure 4-11. A body with emissive material set to full intensity for the yellow (left); the same scene but with just
50 percent intensity (right)
Superficially, emissive materials may look just like the results of using ambient lighting.
But unlike ambient lights, only a single object in your scene will be affected. And as a
side benefit, they don’t use up additional light objects. However, if your emissive objects
do represent real lights of any sort such as the sun, putting a light object inside definitely
adds another layer of authenticity to the scene.
One further note regarding materials: if your object has had the color vertices specified,
as both our cube and sphere have, those values can be used instead of setting
materials. You must call glEnable(GL_COLOR_MATERIAL). This will apply the vertex colors
to the shading system, instead of those specified by the glMaterial calls.
singke
(singke)
#1