| Changing Material Properties 
 GLfloat no_mat[] = { 0.0,
0.0, 0.0, 1.0 }; 
GLfloat mat_ambient[] =
{ 0.7, 0.7, 0.7, 1.0 };
 GLfloat mat_ambient_color[]
= { 0.8, 0.8, 0.2, 1.0 }; GLfloat mat_diffuse[] = { 0.1, 0.5, 0.8, 1.0
};
 GLfloat mat_specular[] =
{ 1.0, 1.0, 1.0, 1.0 };
 GLfloat no_shininess[] =
{ 0.0 };
 GLfloat low_shininess[]
= { 5.0 };
 GLfloat high_shininess[]
= { 100.0 };
 GLfloat mat_emission[] =
{0.3, 0.2, 0.2, 0.0}; glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
 /* draw sphere in first
row, first column * diffuse reflection only; no ambient or specular */
 glPushMatrix();
 glTranslatef (-3.75, 3.0,
0.0);
 glMaterialfv(GL_FRONT, GL_AMBIENT,
no_mat);
 glMaterialfv(GL_FRONT, GL_DIFFUSE,
mat_diffuse);
 glMaterialfv(GL_FRONT, GL_SPECULAR,
no_mat);
 glMaterialfv(GL_FRONT, GL_SHININESS,
no_shininess); glMaterialfv(GL_FRONT, GL_EMISSION, no_mat);
 glutSolidSphere(1.0, 16,
16);
 glPopMatrix();
 ...
 |