Subversion Repositories AndroidProjects

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1452 chris 1
<?xml version="1.0" encoding="UTF-8"?>
2
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3
              "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4
<refentry id="glLightModel">
5
    <refmeta>
6
        <refmetainfo>
7
            <copyright>
8
                <year>1991-2006</year>
9
                <holder>Silicon Graphics, Inc.</holder>
10
            </copyright>
11
        </refmetainfo>
12
        <refentrytitle>glLightModel</refentrytitle>
13
        <manvolnum>3G</manvolnum>
14
    </refmeta>
15
    <refnamediv>
16
        <refname>glLightModel</refname>
17
        <refpurpose>set the lighting model parameters</refpurpose>
18
    </refnamediv>
19
    <refsynopsisdiv><title>C Specification</title>
20
        <funcsynopsis>
21
            <funcprototype>
22
                <funcdef>void <function>glLightModelf</function></funcdef>
23
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
24
                <paramdef>GLfloat <parameter>param</parameter></paramdef>
25
            </funcprototype>
26
        </funcsynopsis>
27
        <funcsynopsis>
28
            <funcprototype>
29
                <funcdef>void <function>glLightModeli</function></funcdef>
30
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
31
                <paramdef>GLint <parameter>param</parameter></paramdef>
32
            </funcprototype>
33
        </funcsynopsis>
34
    </refsynopsisdiv>
35
    <!-- eqn: ignoring delim $$ -->
36
    <refsect1 id="parameters"><title>Parameters</title>
37
        <variablelist>
38
        <varlistentry>
39
            <term><parameter>pname</parameter></term>
40
            <listitem>
41
                <para>
42
                    Specifies a single-valued lighting model parameter.
43
                    <constant>GL_LIGHT_MODEL_LOCAL_VIEWER</constant>,
44
                    <constant>GL_LIGHT_MODEL_COLOR_CONTROL</constant>, and
45
                    <constant>GL_LIGHT_MODEL_TWO_SIDE</constant> are accepted.
46
                </para>
47
            </listitem>
48
        </varlistentry>
49
        <varlistentry>
50
            <term><parameter>param</parameter></term>
51
            <listitem>
52
                <para>
53
                    Specifies the value that <parameter>param</parameter> will be set to.
54
                </para>
55
            </listitem>
56
        </varlistentry>
57
        </variablelist>
58
    </refsect1>
59
    <refsynopsisdiv><title>C Specification</title>
60
        <funcsynopsis>
61
            <funcprototype>
62
                <funcdef>void <function>glLightModelfv</function></funcdef>
63
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
64
                <paramdef>const GLfloat * <parameter>params</parameter></paramdef>
65
            </funcprototype>
66
        </funcsynopsis>
67
        <funcsynopsis>
68
            <funcprototype>
69
                <funcdef>void <function>glLightModeliv</function></funcdef>
70
                <paramdef>GLenum <parameter>pname</parameter></paramdef>
71
                <paramdef>const GLint * <parameter>params</parameter></paramdef>
72
            </funcprototype>
73
        </funcsynopsis>
74
    </refsynopsisdiv>
75
    <refsect1 id="parameters2"><title>Parameters</title>
76
        <variablelist>
77
        <varlistentry>
78
            <term><parameter>pname</parameter></term>
79
            <listitem>
80
                <para>
81
                    Specifies a lighting model parameter.
82
                    <constant>GL_LIGHT_MODEL_AMBIENT</constant>,
83
                    <constant>GL_LIGHT_MODEL_COLOR_CONTROL</constant>,
84
                    <constant>GL_LIGHT_MODEL_LOCAL_VIEWER</constant>, and
85
                    <constant>GL_LIGHT_MODEL_TWO_SIDE</constant> are accepted.
86
                </para>
87
            </listitem>
88
        </varlistentry>
89
        <varlistentry>
90
            <term><parameter>params</parameter></term>
91
            <listitem>
92
                <para>
93
                    Specifies a pointer to the value or values that <parameter>params</parameter> will be set to.
94
                </para>
95
            </listitem>
96
        </varlistentry>
97
        </variablelist>
98
    </refsect1>
99
    <refsect1 id="description"><title>Description</title>
100
        <para>
101
            <function>glLightModel</function> sets the lighting model parameter.
102
            <parameter>pname</parameter> names a parameter and <parameter>params</parameter> gives the new value.
103
            There are three lighting model parameters:
104
        </para>
105
        <variablelist>
106
            <varlistentry>
107
                <term><constant>GL_LIGHT_MODEL_AMBIENT</constant></term>
108
                <listitem>
109
                    <para>
110
                    </para>
111
                    <para>
112
                        <parameter>params</parameter> contains four integer or floating-point values that specify
113
                        the ambient RGBA intensity of the entire scene.
114
                        Integer values are mapped linearly such that the most positive representable
115
                        value maps to 1.0,
116
                        and the most negative representable value maps to
117
                        <inlineequation><mml:math>
118
                            <!-- eqn: -1.0:-->
119
                            <mml:mn>-1.0</mml:mn>
120
                        </mml:math></inlineequation>.
121
                        Floating-point values are mapped directly.
122
                        Neither integer nor floating-point values are clamped.
123
                        The initial ambient scene intensity is (0.2, 0.2, 0.2, 1.0).
124
                    </para>
125
                </listitem>
126
            </varlistentry>
127
            <varlistentry>
128
                <term><constant>GL_LIGHT_MODEL_COLOR_CONTROL</constant></term>
129
                <listitem>
130
                    <para>
131
                    </para>
132
                    <para>
133
                        <parameter>params</parameter> must be either <constant>GL_SEPARATE_SPECULAR_COLOR</constant> or
134
                        <constant>GL_SINGLE_COLOR</constant>.
135
                        <constant>GL_SINGLE_COLOR</constant> specifies that a single color is generated from the
136
                        lighting computation for a vertex.  <constant>GL_SEPARATE_SPECULAR_COLOR</constant>
137
                        specifies that the specular color computation of lighting be stored
138
                        separately from the remainder of the lighting computation.  The specular
139
                        color is summed into the generated fragment's color after the application
140
                        of texture mapping (if enabled).  The initial value is <constant>GL_SINGLE_COLOR</constant>.
141
                    </para>
142
                </listitem>
143
            </varlistentry>
144
            <varlistentry>
145
                <term><constant>GL_LIGHT_MODEL_LOCAL_VIEWER</constant></term>
146
                <listitem>
147
                    <para>
148
                    </para>
149
                    <para>
150
                        <parameter>params</parameter> is a single integer or floating-point value that specifies
151
                        how specular reflection angles are computed.
152
                        If <parameter>params</parameter> is 0 (or 0.0), specular reflection angles take the
153
                        view direction to be parallel to and in the direction of the -<emphasis>z</emphasis> axis,
154
                        regardless of the location of the vertex in eye coordinates.
155
                        Otherwise, specular reflections are computed from the origin
156
                        of the eye coordinate system.
157
                        The initial value is 0.
158
                    </para>
159
                </listitem>
160
            </varlistentry>
161
            <varlistentry>
162
                <term><constant>GL_LIGHT_MODEL_TWO_SIDE</constant></term>
163
                <listitem>
164
                    <para>
165
                    </para>
166
                    <para>
167
                        <parameter>params</parameter> is a single integer or floating-point value that specifies
168
                        whether one- or two-sided lighting calculations are done for polygons.
169
                        It has no effect on the lighting calculations for points,
170
                        lines,
171
                        or bitmaps.
172
                        If <parameter>params</parameter> is 0 (or 0.0), one-sided lighting is specified,
173
                        and only the <emphasis>front</emphasis> material parameters are used in the
174
                        lighting equation.
175
                        Otherwise, two-sided lighting is specified.
176
                        In this case, vertices of back-facing polygons are lighted using the
177
                        <emphasis>back</emphasis> material parameters
178
                        and have their normals reversed before the lighting equation is evaluated.
179
                        Vertices of front-facing polygons are always lighted using the
180
                        <emphasis>front</emphasis> material parameters,
181
                        with no change to their normals. The initial value is 0.
182
                    </para>
183
                </listitem>
184
            </varlistentry>
185
        </variablelist>
186
        <para>
187
            In RGBA mode, the lighted color of a vertex is the sum of
188
            the material emission intensity,
189
            the product of the material ambient reflectance and the lighting model full-scene
190
            ambient intensity,
191
            and the contribution of each enabled light source.
192
            Each light source contributes the sum of three terms:
193
            ambient, diffuse, and specular.
194
            The ambient light source contribution is the product of the material ambient
195
            reflectance and the light's ambient intensity.
196
            The diffuse light source contribution is the product of the material diffuse
197
            reflectance,
198
            the light's diffuse intensity,
199
            and the dot product of the vertex's normal with the normalized vector from
200
            the vertex to the light source.
201
            The specular light source contribution is the product of the material specular
202
            reflectance,
203
            the light's specular intensity,
204
            and the dot product of the normalized vertex-to-eye and vertex-to-light
205
            vectors,
206
            raised to the power of the shininess of the material.
207
            All three light source contributions are attenuated equally based on
208
            the distance from the vertex to the light source and on light source
209
            direction, spread exponent, and spread cutoff angle.
210
            All dot products are replaced with 0 if they evaluate to a negative value.
211
        </para>
212
        <para>
213
            The alpha component of the resulting lighted color is set to the alpha value
214
            of the material diffuse reflectance.
215
        </para>
216
        <para>
217
            In color index mode,
218
            the value of the lighted index of a vertex ranges from the ambient
219
            to the specular values passed to <citerefentry><refentrytitle>glMaterial</refentrytitle></citerefentry> using <constant>GL_COLOR_INDEXES</constant>.
220
            Diffuse and specular coefficients,
221
            computed with a (.30, .59, .11) weighting of the lights' colors,
222
            the shininess of the material,
223
            and the same reflection and attenuation equations as in the RGBA case,
224
            determine how much above ambient the resulting index is.
225
        </para>
226
    </refsect1>
227
    <refsect1 id="notes"><title>Notes</title>
228
        <para>
229
            <constant>GL_LIGHT_MODEL_COLOR_CONTROL</constant> is available only if the GL version is
230
            1.2 or greater.
231
        </para>
232
    </refsect1>
233
    <refsect1 id="errors"><title>Errors</title>
234
        <para>
235
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>pname</parameter> is not an accepted value.
236
        </para>
237
        <para>
238
            <constant>GL_INVALID_ENUM</constant> is generated if <parameter>pname</parameter> is
239
            <constant>GL_LIGHT_MODEL_COLOR_CONTROL</constant> and <parameter>params</parameter> is not one of
240
            <constant>GL_SINGLE_COLOR</constant> or <constant>GL_SEPARATE_SPECULAR_COLOR</constant>.
241
        </para>
242
        <para>
243
            <constant>GL_INVALID_OPERATION</constant> is generated if <function>glLightModel</function> is executed between
244
            the execution of <citerefentry><refentrytitle>glBegin</refentrytitle></citerefentry> and the corresponding execution of <citerefentry><refentrytitle>glEnd</refentrytitle></citerefentry>.
245
        </para>
246
    </refsect1>
247
    <refsect1 id="associatedgets"><title>Associated Gets</title>
248
        <para>
249
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LIGHT_MODEL_AMBIENT</constant>
250
        </para>
251
        <para>
252
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LIGHT_MODEL_COLOR_CONTROL</constant>
253
        </para>
254
        <para>
255
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LIGHT_MODEL_LOCAL_VIEWER</constant>
256
        </para>
257
        <para>
258
            <citerefentry><refentrytitle>glGet</refentrytitle></citerefentry> with argument <constant>GL_LIGHT_MODEL_TWO_SIDE</constant>
259
        </para>
260
        <para>
261
            <citerefentry><refentrytitle>glIsEnabled</refentrytitle></citerefentry> with argument <constant>GL_LIGHTING</constant>
262
        </para>
263
    </refsect1>
264
    <refsect1 id="seealso"><title>See Also</title>
265
        <para>
266
            <citerefentry><refentrytitle>glLight</refentrytitle></citerefentry>,
267
            <citerefentry><refentrytitle>glMaterial</refentrytitle></citerefentry>
268
        </para>
269
    </refsect1>
270
    <refsect1 id="Copyright"><title>Copyright</title>
271
        <para>
272
            Copyright <trademark class="copyright"></trademark> 1991-2006
273
            Silicon Graphics, Inc. This document is licensed under the SGI
274
            Free Software B License. For details, see
275
            <ulink url="http://oss.sgi.com/projects/FreeB/">http://oss.sgi.com/projects/FreeB/</ulink>.
276
        </para>
277
    </refsect1>
278
</refentry>