<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html
  PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd">
<html
	xmlns="http://www.w3.org/1999/xhtml"
	xmlns:mml="http://www.w3.org/1998/Math/MathML"
><head><title>glLightModel</title><link rel="stylesheet" href="style.css" type="text/css"/><meta name="generator" content="DocBook XSL Stylesheets V1.59.1"/><link rel="home" href="index.xml" title="PyOpenGL 2.0.1.07 Man Pages"/><link rel="up" href="reference-GL.xml" title="GL"/><link rel="previous" href="glLight.3G.xml" title="glLight"/><link rel="next" href="glLineStipple.3G.xml" title="glLineStipple"/></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">glLightModel</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="glLight.3G.xml">Prev</a> </td><th width="60%" align="center">GL</th><td width="20%" align="right"> <a accesskey="n" href="glLineStipple.3G.xml">Next</a></td></tr></table><hr/></div><div class="refentry" lang="en"><a name="glLightModel.3G"/><div class="titlepage"/><div class="refnamediv"><a name="glLightModel.3G-name"/><h2>Name</h2><p>glLightModelf, glLightModeli, glLightModelfv, glLightModeliv &#8212; set the lighting model parameters</p></div><div class="refsynopsisdiv"><a name="glLightModel.3G-c_spec"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glLightModelf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>pname</tt></i>, GLfloat <i><tt>param</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glLightModeli</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>pname</tt></i>, GLint <i><tt>param</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glLightModel.3G-python_spec"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glLightModelf</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pname</tt></i>, <i><tt>param</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glLightModeli</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pname</tt></i>, <i><tt>param</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glLightModel.3G-parameters"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>pname</tt></i></span></dt><dd>
						Specifies a single-valued lighting model parameter. <tt>GL_LIGHT_MODEL_LOCAL_VIEWER</tt>,
						<tt>GL_LIGHT_MODEL_COLOR_CONTROL</tt>, and <tt>GL_LIGHT_MODEL_TWO_SIDE</tt> are
						accepted.
					</dd><dt><span class="term"><i><tt>param</tt></i></span></dt><dd>
						Specifies the value that <i><tt>param</tt></i> will be set to.
					</dd></dl></div></div><div class="refsynopsisdiv"><a name="glLightModel.3G-c_spec-v"/><h2>C Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code>void <tt>glLightModelfv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>pname</tt></i>, const GLfloat *<i><tt>params</tt></i>);</code></td></tr><tr><td valign="top"><code>void <tt>glLightModeliv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code>GLenum <i><tt>pname</tt></i>, const GLint *<i><tt>params</tt></i>);</code></td></tr></table></div><div class="refsynopsisdiv"><a name="glLightModel.3G-python_spec-v"/><h2>Python Specification</h2><table class="funcprototype" border="0" cellpadding="0" cellspacing="0"><tr><td valign="top"><code><tt>glLightModelfv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pname</tt></i>, <i><tt>params</tt></i>) &#8594; <tt>None</tt></code></td></tr><tr><td valign="top"><code><tt>glLightModeliv</tt></code></td><td valign="top"><code>(</code></td><td valign="top"><code><i><tt>pname</tt></i>, <i><tt>params</tt></i>) &#8594; <tt>None</tt></code></td></tr></table></div><div class="refsect1" lang="en"><a name="glLightModel.3G-parameters-v"/><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><i><tt>pname</tt></i></span></dt><dd>
						Specifies a lighting model parameter. <tt>GL_LIGHT_MODEL_AMBIENT</tt>,
						<tt>GL_LIGHT_MODEL_COLOR_CONTROL</tt>, <tt>GL_LIGHT_MODEL_LOCAL_VIEWER</tt>, and
						<tt>GL_LIGHT_MODEL_TWO_SIDE</tt> are accepted.
					</dd><dt><span class="term"><i><tt>params</tt></i></span></dt><dd>
						Specifies a pointer to the value or values that <i><tt>params</tt></i> will be set to.
					</dd></dl></div></div><div class="refsect1" lang="en"><a name="glLightModel.3G-description"/><h2>Description</h2><p>
			<tt>glLightModel</tt> sets the lighting model parameter. <i><tt>pname</tt></i>
			names a parameter and <i><tt>params</tt></i> gives the new value. There are three lighting model parameters:
		</p><div class="variablelist"><dl><dt><span class="term"><tt>GL_LIGHT_MODEL_AMBIENT</tt></span></dt><dd>
						<i><tt>params</tt></i> contains four integer or floating-point values that specify the ambient RGBA
						intensity of the entire scene. Integer values are mapped linearly such that the most positive representable
						value maps to 1.0, and the most negative representable value maps to -1.0. Floating-point values are mapped
						directly. Neither integer nor floating-point values are clamped. The initial ambient scene intensity is
						(0.2, 0.2, 0.2, 1.0).
					</dd><dt><span class="term"><tt>GL_LIGHT_MODEL_COLOR_CONTROL</tt></span></dt><dd>
						<i><tt>params</tt></i> must be either <tt>GL_SEPARATE_SPECULAR_COLOR</tt> or
						<tt>GL_SINGLE_COLOR</tt>. <tt>GL_SINGLE_COLOR</tt> specifies that a single color is
						generated from the lighting computation for a vertex. <tt>GL_SEPARATE_SPECULAR_COLOR</tt>
						specifies that the specular color computation of lighting be stored separately from the remainder of the
						lighting computation. The specular color is summed into the generated fragment's color after the
						application of texture mapping (if enabled). The initial value is <tt>GL_SINGLE_COLOR</tt>.
					</dd><dt><span class="term"><tt>GL_LIGHT_MODEL_LOCAL_VIEWER</tt></span></dt><dd>
						<i><tt>params</tt></i> is a single integer or floating-point value that specifies how specular
						reflection angles are computed. If <i><tt>params</tt></i> is 0 (or 0.0), specular reflection angles
						take the view direction to be parallel to and in the direction of the -<i><tt>z</tt></i> axis,
						regardless of the location of the vertex in eye coordinates. Otherwise, specular reflections are computed
						from the origin of the eye coordinate system. The initial value is 0.
					</dd><dt><span class="term"><tt>GL_LIGHT_MODEL_TWO_SIDE</tt></span></dt><dd>
						<i><tt>params</tt></i> is a single integer or floating-point value that specifies whether one- or
						two-sided lighting calculations are done for polygons. It has no effect on the lighting calculations for
						points, lines, or bitmaps. If <i><tt>params</tt></i> is 0 (or 0.0), one-sided lighting is specified,
						and only the <i><tt>front</tt></i> material parameters are used in the lighting equation. Otherwise,
						two-sided lighting is specified. In this case, vertices of back-facing polygons are lighted using the
						<i><tt>back</tt></i> material parameters, and have their normals reversed before the lighting
						equation is evaluated. Vertices of front-facing polygons are always lighted using the
						<i><tt>front</tt></i> material parameters, with no change to their normals. The initial value is 0.
					</dd></dl></div><p>
			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 if they evaluate to a negative value.
		</p><p>
			The alpha component of the resulting lighted color is set to the alpha value of the material diffuse reflectance.
		</p><p>
			In color index mode, the value of the lighted index of a vertex ranges from the ambient to the specular values passed
			to <tt>glMaterial</tt> using <tt>GL_COLOR_INDEXES</tt>. Diffuse and
			specular coefficients, computed with a (.30, .59, .11) weighting of the lights' colors, the shininess of the material,
			and the same reflection and attenuation equations as in the RGBA case, determine how much above ambient the resulting
			index is.
		</p></div><div class="refsect1" lang="en"><a name="glLightModel.3G-notes"/><h2>Notes</h2><p>
			<tt>GL_LIGHT_MODEL_COLOR_CONTROL</tt> is available only if the GL version is 1.2 or greater.
		</p></div><div class="refsect1" lang="en"><a name="glLightModel.3G-errors"/><h2>Errors</h2><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>pname</tt></i> is not an accepted value.
		</p><p>
			<tt>GL_INVALID_ENUM</tt> is generated if <i><tt>pname</tt></i> is
			<tt>GL_LIGHT_MODEL_COLOR_CONTROL</tt> and <i><tt>params</tt></i> is not one of
			<tt>GL_SINGLE_COLOR</tt> or <tt>GL_SEPARATE_SPECULAR_COLOR</tt>.
		</p><p>
			<tt>GL_INVALID_OPERATION</tt> is generated if <tt>glLightModel</tt> is
			executed between the execution of <a href="glBegin.3G.xml"><tt>glBegin</tt></a> and the corresponding execution of
			<a href="glBegin.3G.xml"><tt>glEnd</tt></a>.
		</p></div><div class="refsect1" lang="en"><a name="glLightModel.3G-associated_gets"/><h2>Associated Gets</h2><p>
			<tt>glGet</tt> with argument <tt>GL_LIGHT_MODEL_AMBIENT</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_LIGHT_MODEL_COLOR_CONTROL</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_LIGHT_MODEL_LOCAL_VIEWER</tt>
		</p><p>
			<tt>glGet</tt> with argument <tt>GL_LIGHT_MODEL_TWO_SIDE</tt>
		</p><p>
			<a href="glIsEnabled.3G.xml"><tt>glIsEnabled</tt></a> with argument <tt>GL_LIGHTING</tt>
		</p></div><div class="refsect1" lang="en"><a name="glLightModel.3G-see_also"/><h2>See Also</h2><p>
			<span class="simplelist"><a href="glLight.3G.xml">glLight</a>, <a href="glMaterial.3G.xml">glMaterial</a></span>
		</p></div></div><div class="navfooter"><hr/><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="glLight.3G.xml">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="reference-GL.xml">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="glLineStipple.3G.xml">Next</a></td></tr><tr><td width="40%" align="left" valign="top">glLight </td><td width="20%" align="center"><a accesskey="h" href="index.xml">Home</a></td><td width="40%" align="right" valign="top"> glLineStipple</td></tr></table></div></body></html>