Sets the lighting model parameters.

OpenGL C bindings library: **libGL.a**

void glLightModelf(GLenumParameterName,GLfloatParameter)

void glLightModeli(GLenumParameterName,GLintParameter)

void glLightModelfv(GLenumParameterName,const GLfloat *ParameterValues)

void glLightModeliv(GLenumParameterName,const GLint *ParameterValues)

The **glLightModel** subroutine sets the lighting model parameters. *ParameterName* names a parameter and *ParameterValues* gives the new value. There are three lighting model parameters:

In RGBA mode, the lighted color of a vertex is the sum of the material emission intensity, the product of the material ambient reflectance and the lighting model full-scene ambient intensity, and the contribution of each enabled light source. Each light source contributes the sum of three terms: ambient, diffuse, and specular.

- The ambient light source contribution is the product of the material ambient reflectance and the light's ambient intensity.
- The diffuse light source contribution is the product of the material diffuse reflectance, the light's diffuse intensity, and the dot product of the vertex's normal with the normalized vector from the vertex to the light source.
- The specular light source contribution is the product of the material specular reflectance, the light's specular intensity, and the dot product of the normalized vertex-to-eye and vertex-to-light vectors, raised to the power of the shininess of the material.

All three light source contributions are attenuated equally based on the distance from the vertex to the light source and on light source direction, spread exponent, and spread cutoff angle. All dot products are replaced with 0 (zero) if they are a negative value.

The alpha component of the resulting lighted color is set to the alpha value of the material diffuse reflectance.

In color index mode, the value of the lighted index of a vertex ranges from the ambient to the specular values passed to **glMaterial** using **GL_COLOR_INDEXES**. The extent to which the resulting index is above *ambient* is determined by diffuse and specular coefficients, computed with a weighting of the lights' colors (.30, .59, .11); the shininess of the material; and the same reflection and attenuation equations as in the RGBA case.

GL_INVALID_ENUM |
ParameterName is not an accepted value. |

GL_INVALID_OPERATION |
The glLightModel subroutine is called between a call to glBegin and the corresponding call to glEnd. |

Associated gets for the **glLightModel **subroutine are as follows. (See the **glGet** subroutine for more information.)

**glGet** with argument **GL_LIGHT_MODEL_AMBIENT**

**glGet** with argument **GL_LIGHT_MODEL_LOCAL_VIEWER**

**glGet** with argument **GL_LIGHT_MODEL_TWO_SIDE**

**glIsEnabled** with argument **GL_LIGHTING**.

/usr/include/GL/gl.h |
Contains C language constants, variable type definitions, and ANSI function prototypes for OpenGL. |

The **glBegin** or **glEnd** subroutine, **glEnable** or **glDisable **subroutine, **glLight** subroutine, **glMaterial** subroutine.