6ecef6361f0cbf562b23820a65bca42c07d56608
[clinton/guile-figl.git] / upstream-man-pages / man2 / xhtml / glLightModel.xml
1 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "xhtml1-transitional.dtd">
2 <!-- saved from url=(0013)about:internet -->
3 <?xml-stylesheet type="text/xsl" href="mathml.xsl"?><html xmlns="http://www.w3.org/1999/xhtml" xmlns:pref="http://www.w3.org/2002/Math/preference" pref:renderer="mathplayer-dl"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>glLightModel</title><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /></head><body><div class="refentry" lang="en" xml:lang="en"><a id="glLightModel"></a><div class="titlepage"></div><div class="refnamediv"><h2>Name</h2><p>glLightModel — set the lighting model parameters</p></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glLightModelf</b>(</code></td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLfloat  </td><td><var class="pdparam">param</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glLightModeli</b>(</code></td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>GLint  </td><td><var class="pdparam">param</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
4 Specifies a single-valued lighting model parameter.
5 <code class="constant">GL_LIGHT_MODEL_LOCAL_VIEWER</code>,
6 <code class="constant">GL_LIGHT_MODEL_COLOR_CONTROL</code>, and
7 <code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code> are accepted.
8 </p></dd><dt><span class="term"><em class="parameter"><code>param</code></em></span></dt><dd><p>
9 Specifies the value that <em class="parameter"><code>param</code></em> will be set to.
10 </p></dd></dl></div></div><div class="refsynopsisdiv"><h2>C Specification</h2><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glLightModelfv</b>(</code></td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLfloat *  </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div><div class="funcsynopsis"><table border="0" summary="Function synopsis" cellspacing="0" cellpadding="0"><tr><td><code class="funcdef">void <b class="fsfunc">glLightModeliv</b>(</code></td><td>GLenum  </td><td><var class="pdparam">pname</var>, </td></tr><tr><td> </td><td>const GLint *  </td><td><var class="pdparam">params</var><code>)</code>;</td></tr></table></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="parameters2"></a><h2>Parameters</h2><div class="variablelist"><dl><dt><span class="term"><em class="parameter"><code>pname</code></em></span></dt><dd><p>
11 Specifies a lighting model parameter.
12 <code class="constant">GL_LIGHT_MODEL_AMBIENT</code>,
13 <code class="constant">GL_LIGHT_MODEL_COLOR_CONTROL</code>,
14 <code class="constant">GL_LIGHT_MODEL_LOCAL_VIEWER</code>, and
15 <code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code> are accepted.
16 </p></dd><dt><span class="term"><em class="parameter"><code>params</code></em></span></dt><dd><p>
17 Specifies a pointer to the value or values that <em class="parameter"><code>params</code></em> will be set to.
18 </p></dd></dl></div></div><div class="refsect1" lang="en" xml:lang="en"><a id="description"></a><h2>Description</h2><p>
19 <code class="function">glLightModel</code> sets the lighting model parameter.
20 <em class="parameter"><code>pname</code></em> names a parameter and <em class="parameter"><code>params</code></em> gives the new value.
21 There are three lighting model parameters:
22 </p><div class="variablelist"><dl><dt><span class="term"><code class="constant">GL_LIGHT_MODEL_AMBIENT</code></span></dt><dd><p>
23 </p><p>
24 <em class="parameter"><code>params</code></em> contains four integer or floating-point values that specify
25 the ambient RGBA intensity of the entire scene.
26 Integer values are mapped linearly such that the most positive representable
27 value maps to 1.0,
28 and the most negative representable value maps to
29 <mml:math xmlns:mml="http://www.w3.org/1998/Math/MathML" overflow="scroll">
30
31 <mml:mn>-1.0</mml:mn>
32 </mml:math>.
33 Floating-point values are mapped directly.
34 Neither integer nor floating-point values are clamped.
35 The initial ambient scene intensity is (0.2, 0.2, 0.2, 1.0).
36 </p></dd><dt><span class="term"><code class="constant">GL_LIGHT_MODEL_COLOR_CONTROL</code></span></dt><dd><p>
37 </p><p>
38 <em class="parameter"><code>params</code></em> must be either <code class="constant">GL_SEPARATE_SPECULAR_COLOR</code> or
39 <code class="constant">GL_SINGLE_COLOR</code>.
40 <code class="constant">GL_SINGLE_COLOR</code> specifies that a single color is generated from the
41 lighting computation for a vertex. <code class="constant">GL_SEPARATE_SPECULAR_COLOR</code>
42 specifies that the specular color computation of lighting be stored
43 separately from the remainder of the lighting computation. The specular
44 color is summed into the generated fragment's color after the application
45 of texture mapping (if enabled). The initial value is <code class="constant">GL_SINGLE_COLOR</code>.
46 </p></dd><dt><span class="term"><code class="constant">GL_LIGHT_MODEL_LOCAL_VIEWER</code></span></dt><dd><p>
47 </p><p>
48 <em class="parameter"><code>params</code></em> is a single integer or floating-point value that specifies
49 how specular reflection angles are computed.
50 If <em class="parameter"><code>params</code></em> is 0 (or 0.0), specular reflection angles take the
51 view direction to be parallel to and in the direction of the -<span class="emphasis"><em>z</em></span> axis,
52 regardless of the location of the vertex in eye coordinates.
53 Otherwise, specular reflections are computed from the origin
54 of the eye coordinate system.
55 The initial value is 0.
56 </p></dd><dt><span class="term"><code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code></span></dt><dd><p>
57 </p><p>
58 <em class="parameter"><code>params</code></em> is a single integer or floating-point value that specifies
59 whether one- or two-sided lighting calculations are done for polygons.
60 It has no effect on the lighting calculations for points,
61 lines,
62 or bitmaps.
63 If <em class="parameter"><code>params</code></em> is 0 (or 0.0), one-sided lighting is specified,
64 and only the <span class="emphasis"><em>front</em></span> material parameters are used in the
65 lighting equation.
66 Otherwise, two-sided lighting is specified.
67 In this case, vertices of back-facing polygons are lighted using the
68 <span class="emphasis"><em>back</em></span> material parameters
69 and have their normals reversed before the lighting equation is evaluated.
70 Vertices of front-facing polygons are always lighted using the
71 <span class="emphasis"><em>front</em></span> material parameters,
72 with no change to their normals. The initial value is 0.
73 </p></dd></dl></div><p>
74 In RGBA mode, the lighted color of a vertex is the sum of
75 the material emission intensity,
76 the product of the material ambient reflectance and the lighting model full-scene
77 ambient intensity,
78 and the contribution of each enabled light source.
79 Each light source contributes the sum of three terms:
80 ambient, diffuse, and specular.
81 The ambient light source contribution is the product of the material ambient
82 reflectance and the light's ambient intensity.
83 The diffuse light source contribution is the product of the material diffuse
84 reflectance,
85 the light's diffuse intensity,
86 and the dot product of the vertex's normal with the normalized vector from
87 the vertex to the light source.
88 The specular light source contribution is the product of the material specular
89 reflectance,
90 the light's specular intensity,
91 and the dot product of the normalized vertex-to-eye and vertex-to-light
92 vectors,
93 raised to the power of the shininess of the material.
94 All three light source contributions are attenuated equally based on
95 the distance from the vertex to the light source and on light source
96 direction, spread exponent, and spread cutoff angle.
97 All dot products are replaced with 0 if they evaluate to a negative value.
98 </p><p>
99 The alpha component of the resulting lighted color is set to the alpha value
100 of the material diffuse reflectance.
101 </p><p>
102 In color index mode,
103 the value of the lighted index of a vertex ranges from the ambient
104 to the specular values passed to <a class="citerefentry" href="glMaterial.xml"><span class="citerefentry"><span class="refentrytitle">glMaterial</span></span></a> using <code class="constant">GL_COLOR_INDEXES</code>.
105 Diffuse and specular coefficients,
106 computed with a (.30, .59, .11) weighting of the lights' colors,
107 the shininess of the material,
108 and the same reflection and attenuation equations as in the RGBA case,
109 determine how much above ambient the resulting index is.
110 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="notes"></a><h2>Notes</h2><p>
111 <code class="constant">GL_LIGHT_MODEL_COLOR_CONTROL</code> is available only if the GL version is
112 1.2 or greater.
113 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="errors"></a><h2>Errors</h2><p>
114 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>pname</code></em> is not an accepted value.
115 </p><p>
116 <code class="constant">GL_INVALID_ENUM</code> is generated if <em class="parameter"><code>pname</code></em> is
117 <code class="constant">GL_LIGHT_MODEL_COLOR_CONTROL</code> and <em class="parameter"><code>params</code></em> is not one of
118 <code class="constant">GL_SINGLE_COLOR</code> or <code class="constant">GL_SEPARATE_SPECULAR_COLOR</code>.
119 </p><p>
120 <code class="constant">GL_INVALID_OPERATION</code> is generated if <code class="function">glLightModel</code> is executed between
121 the execution of <a class="citerefentry" href="glBegin.xml"><span class="citerefentry"><span class="refentrytitle">glBegin</span></span></a> and the corresponding execution of <a class="citerefentry" href="glEnd.xml"><span class="citerefentry"><span class="refentrytitle">glEnd</span></span></a>.
122 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="associatedgets"></a><h2>Associated Gets</h2><p>
123 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LIGHT_MODEL_AMBIENT</code>
124 </p><p>
125 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LIGHT_MODEL_COLOR_CONTROL</code>
126 </p><p>
127 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LIGHT_MODEL_LOCAL_VIEWER</code>
128 </p><p>
129 <a class="citerefentry" href="glGet.xml"><span class="citerefentry"><span class="refentrytitle">glGet</span></span></a> with argument <code class="constant">GL_LIGHT_MODEL_TWO_SIDE</code>
130 </p><p>
131 <a class="citerefentry" href="glIsEnabled.xml"><span class="citerefentry"><span class="refentrytitle">glIsEnabled</span></span></a> with argument <code class="constant">GL_LIGHTING</code>
132 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="seealso"></a><h2>See Also</h2><p>
133 <a class="citerefentry" href="glLight.xml"><span class="citerefentry"><span class="refentrytitle">glLight</span></span></a>,
134 <a class="citerefentry" href="glMaterial.xml"><span class="citerefentry"><span class="refentrytitle">glMaterial</span></span></a>
135 </p></div><div class="refsect1" lang="en" xml:lang="en"><a id="Copyright"></a><h2>Copyright</h2><p>
136 Copyright <span class="trademark"></span>© 1991-2006
137 Silicon Graphics, Inc. This document is licensed under the SGI
138 Free Software B License. For details, see
139 <a class="ulink" href="http://oss.sgi.com/projects/FreeB/" target="_top">http://oss.sgi.com/projects/FreeB/</a>.
140 </p></div></div></body></html>