Game Development Reference
In-Depth Information
material up. At the extreme you will simply have a white disc. Before we
look in detail at how this demonstration program works we will have a
short introduction to material properties.
Using materials in OpenGL
Each material has parameters for ambient, diffuse, specular, shininess
and emission. By carefully setting these levels the material can be made
to ignore any ambient light or have a specular colour that combines with
a light's specular colour in an interesting way. The emission parameter
sets whether the material is self-illuminating or luminous. Shininess has
just the effect you would expect; it can take a value between 0 and 128.
Table 4.2 lists the parameters together with their default values.
Table 4.2 OpenGL material parameters
Parameter name
Default value
(0.2, 0.2, 0.2, 1.0)
Ambient colour of material
(0.8, 0.8, 0.8, 1.0)
Diffuse colour of material
(0.0, 0.0, 0.0, 1.0)
Specular colour of material
Specular exponent
(0.0, 0.0, 0.0, 1.0)
Emissive colour of material
It is worth noting that, despite having an alpha setting for most values,
only the alpha value of diffuse is used in the calculations for the alpha
How lights and materials are used in the rendering of a
frame update
Firstly, we use the following enables. In the sample program these are
never altered so are placed in the window creation function.
Search Nedrilad ::

Custom Search