GLfloat material_diffuse = { 1, 0, 0, 1 };
GLfloat material_specular = { 1, 1, 1, 1 };
GLfloat material_shininess = { 100 };
glMaterialfv(GL_FRONT, GL_DIFFUSE, material_diffuse);
glMaterialfv(GL_FRONT, GL_SPECULAR, material_specular);
glMaterialfv(GL_FRONT, GL_SHININESS, material_shininess);
- A material can have separate diffuse color and specular color
- Diffuse color is the "color" we tend to think of
- Specular color is the color of highlights
- Specular color tends to be white for plastics, same as diffuse color for
metals
- An OpenGL material also has a "shininess" - determines width of specular
peak
- Other fancy stuff settable with glMaterialfv, including separate
color for front and back.
- Another possibility - glColorMaterial - lets you vary material
parameters across the surface by calling glColor3f