• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    EXT_light_texture
4
5Name Strings
6
7    GL_EXT_light_texture
8
9Version
10
11    Last Modified Date: September 26, 1998
12    Author Revision: $Header: //depot/main/doc/registry/extensions/EXT/light_texture.spec#15 $
13
14Number
15
16    117
17
18Dependencies
19
20    OpenGL 1.1 is required.
21    EXT_fragment_lighting is required.
22    EXT_multitexture affects the definition of this extension.
23    SGIX_shadow affects the definition of this extension.
24    SGIX_color_range affects the definition of this extension.
25
26Overview
27
28    This extension defines a general mechanism for substituting the
29    fragment color computed during texture environment processing in
30    place of other fragment attributes such as the fragment normal, or
31    as sources for some of the computations in the fragment processing
32    pipeline, for example as material or light parameters in the
33    fragment lighting computations.
34
35
36    Cf ----------------------+
37                             |                 +-> to lighting parameters
38                             v                 |
39    +------------+        +--------+     +-------------+
40    |            |        |        |     |             |
41    | texel      |------->| texenv |-----| texture     |---> Cf' (to Light Environment
42    | generation |        |        |     | application |          or Fog)
43    |            |        |        |     |             |
44    +------------+        +--------+     +-------------+
45
46
47Patent Note
48
49    To the extent that SGI has patent rights that are unavoidably
50    infringed by all implementations of this extension, SGI will, upon
51    request, grant a license under such patent rights to the requesting
52    party subject to reasonable terms and conditions, and without
53    incremental charge or fee. Such license shall be non-exclusive, and
54    non-transferable, and shall be limited to implementations of the
55    extension in combination with any conformance certified
56    implementation of the OpenGL API. Such license is expressly
57    contingent upon a grant back of a non-exclusive, royalty-free,
58    perpetual, worldwide license to SGI and its OpenGL licensees under
59    the requesting party's patent rights that are unavoidably infringed
60    by all implementations of this extension or OpenGL.
61
62Issues
63
64    *  normal3 rather than normal?
65
66    *  other parameters, spotlight fall off, ...
67
68    *  implications of extended range colors. (do we clamp to [0,1]?)
69
70    *  TexturePath or DirectTexture rather than ApplyTexture?
71
72    *  special handling for alpha or luminance textures? (colormask?)
73
74    *  more tokens for driving multiple inputs, e.g. AMBIENT_DIFFUSE_AND_SPECULAR
75
76    *  normals need to be in the range [-1,1]
77
78        when a texture is used as a normal, its components are scaled
79        and biased to the range [-1,1].
80
81
82New Procedures and Functions
83
84    void ApplyTextureEXT(enum mode);
85    void TextureLightEXT(enum pname)
86    void TextureMaterialEXT(enum face, enum mode);
87
88New Tokens
89
90    Accepted by the <mode> parameter of ApplyTextureEXT:
91
92    FRAGMENT_MATERIAL_EXT                       0x8349
93    FRAGMENT_NORMAL_EXT                         0x834A
94    FRAGMENT_DEPTH_EXT                          0x8452
95    FRAGMENT_COLOR_EXT                          0x834C
96
97    (*note*: FRAGMENT_DEPTH_EXT value changed from 0x834B on promotion
98    from SGIX, to avoid collision with EXT_fog_coord).
99
100    Accepted by the <pname> parameter of TextureLightEXT:
101
102    ATTENUATION_EXT                             0x834D
103    SHADOW_ATTENUATION_EXT                      0x834E
104
105    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
106    and GetDoublev:
107
108    TEXTURE_APPLICATION_MODE_EXT                0x834F
109    TEXTURE_LIGHT_EXT                           0x8350
110    TEXTURE_MATERIAL_FACE_EXT                   0x8351
111    TEXTURE_MATERIAL_PARAMETER_EXT              0x8352
112
113
114Additions to Chapter 2 of the 1.1 Specification (OpenGL Operation)
115
116    None
117
118Additions to Chapter 3 of the 1.1 Specification (Rasterization)
119
120    Immediately before section 3.9 Fog:
121
122    Section 3.X Texture Application
123
124    The command
125
126    ApplyTextureEXT(enum mode);
127
128    determines how the color produced as a result of texture
129    environment processing is used for subsequent fragment
130    operations. Table 3.X.1 summarizes the interpretation of color
131    values for the values of the <mode> parameter.
132
133
134    --
135    FRAGMENT_COLOR_EXT      color is used as fragment color value
136    FRAGMENT_DEPTH_EXT      color is used as fragment depth value
137    FRAGMENT_LIGHT0_EXT     color is specified parameter for fragment light 0
138    ...
139    FRAGMENT_LIGHTn_EXT     color is specified parameter for fragment light n
140    FRAGMENT_MATERIAL_EXT   color is specified material parameter(s)
141    FRAGMENT_NORMAL_EXT     color is used as fragment normal
142
143    Table 3.X.1 ApplyTextureEXT
144    --
145
146    If <mode> is FRAGMENT_COLOR_EXT then the post-texture-environment
147    color is used as the fragment color during later fragment
148    computations.  This is the default behavior.  If <mode> is not
149    FRAGMENT_COLOR_EXT then the fragment color is the
150    pre-texture-environment color.
151
152    If <mode> is FRAGMENT_DEPTH_EXT then the red component of the
153    post-texture-environment color replaces the depth value for the
154    fragment.
155
156    If <mode> is FRAGMENT_NORMAL_EXT then the R, G, and B components
157    of the post-texture-environment color are used to compute the
158    components nx, ny, and nz of the fragment normal vector as follows:
159
160            nx = 2*R-1
161            ny = 2*G-1
162            nz = 2*B-1
163
164    In effect, the post-texture-environment color components are scaled
165    and biased so that their range is [-1,1].
166
167    If <mode> is one of FRAGMENT_LIGHT0_EXT .. FRAGMENT_LIGHTn_EXT
168    then the post-texture-environment color substitutes a fragment
169    lighting parameter of the light indicated by <mode> during the
170    lighting computation for that fragment.  The substututed lighting
171    parameter is specified by the TextureLightEXT command described
172    in Section 3.X.2.
173
174    If <mode> is FRAGMENT_MATERIAL_EXT then the
175    post-texture-environment color substitutes a fragment material
176    parameter during the lighting computation for that fragment.  The
177    fragment material parameter substituted is specified by the
178    TextureMaterialEXT command described in Section 3.X.3.
179
180    If <mode> is changed from FRAGMENT_MATERIAL_EXT or
181    FRAGMENT_LIGHT0_EXT .. FRAGMENT_LIGHTn_EXT to another value, the
182    corresponding material or light parameter reverts back to the
183    current state value for that parameter, i.e., the value most
184    recently specified with one of the FragmentMaterial{T}[v]EXT or
185    FragmentLight{T}[v]EXT commands.  In particular, the state
186    parameters corresponding to the portions of the fragment lighting
187    computations being substituted by the texture application mode
188    continue to track the values specified by the
189    FragmentMaterial{T}[v]EXT and FragmentLight{T}[v]EXT commands.
190
191
192    Section 3.X.2 Texture Applied to Light Parameters
193
194    The command
195
196    TextureLightEXT(enum pname);
197
198    determines which fragment light parameter is substituted with the
199    post-texture-environment color when the texture application mode
200    is one of the fragment lights. <pname> is one of AMBIENT, DIFFUSE,
201    SPECULAR, or ATTENUATION_EXT. If <pname> is AMBIENT, DIFFUSE, or
202    SPECULAR then the ambient, diffuse, or specular intensity
203    parameter is substituted.  If <pname> is ATTENUATION_EXT, then
204    the attenuation term att_i from equation (2.4) is subsituted with
205    the value of the red component of the post-texture-environment
206    color.  If <pname> is SHADOW_ATTENUATION_EXT then the fragment
207    lighting equation is augmented with an additional attenuation term
208    Shad_i:
209
210    Cl =  Em
211       + Am*As
212       SUM{_i = 0 through Nf-1} {
213       + Shad_i*Atten_i*SpotL_i*{
214            + Am*Al_i
215            + Dm*Dl_i*(N.L_i)
216            + Sm*Sl_i*(N.H_i)^n
217          }
218        }
219
220    with Shad_i coming from the red component of the post-texture-environment
221    color.  If a post-environment texture color is not applied to
222    SHADOW_ATTENUATION_EXT for fragment light <i>, then Shad_i is effectively
223    1.0.
224
225
226    Section 3.X.3 Texture Applied to Material Parameters
227
228    The command
229
230    TextureMaterialEXT(enum face, enum mode);
231
232    determines which fragment material parameter is substituted with
233    the post-texture-environment color when the texture application
234    mode is FRAGMENT_MATERIAL_EXT.  <face> is one of FRONT, BACK, or
235    FRONT_AND_BACK, indicating whether the front material, back
236    material, or both are affected by the current color.  <mode> is on
237    of EMISSION, AMBIENT, DIFFUSE, SPECULAR, SHININESS, or
238    AMBIENT_AND_DIFFUSE and specifies which material property or
239    properties are substituted with the post-texture-environment
240    color.  If <mode> is EMISSION, AMBIENT, DIFFUSE, or SPECULAR, then
241    the value of e_cm, a_cm, d_cm, or s_cm from the fragment lighting
242    equations, respectively, will be substituted with the
243    post-texture-environment color.  If <mode> is AMBIENT_AND_DIFFUSE,
244    both a_cm and d_cm will be substituted.  If <mode> is SHININESS,
245    then s_rm will be substituted with 128.0*r, where r is the value
246    of the red component of the post-texture-environment color.
247
248    Section 3.X.4 Interactions with multiple textures
249
250    The color computed during texture environment processing for each
251    active texture can be independently controlled using
252    ApplyTextureEXT.  In the initial state all texture application
253    modes are FRAGMENT_COLOR_EXT and the logical flow of fragment
254    information through the OpenGL pipeline is shown in figure 3.X.5
255    with the result color of each texture environment stage serving as
256    input for the following stage.
257
258
259             Ct0        Ct1                Ctn
260              |          |                  |
261          +------+   +------+           +------+
262          |      |   |      |           |      |
263      Cf -| TE0  |-->| TE1  |--> ... -->| TEn  |--> Cf' (to fragment lighting/fog)
264          |      |   |      |           |      |
265          +------+   +------+           +------+
266
267    Figure 3.X.5
268
269    If the application mode for texture <i> is set to something other
270    than FRAGMENT_COLOR_EXT, then the input for texture environment
271    <i+1> becomes the original pre-texturing fragment color Cf.  If
272    the application mode for texture <i> is returned to
273    FRAGMENT_COLOR_EXT, then the input for texture environment <i+1>
274    reverts back to the result from texture environment <i>.  If i is
275    the last texture in the chain, then the pre-texturing fragment
276    color Cf is used for all subsequent fragment processing.  Figure
277    3.X.6 illustrates the case for the application mode for texture 1
278    set to something other than FRAGMENT_COLOR_EXT.
279
280             Ct0        Ct1          Ct2             Ctn
281              |          |    ^       |               |
282          +------+   +------+ |   +------+        +------+
283          |      |   |      | |   |      |        |      |
284      Cf -| TE0  |-->| TE1  |-+ +-| TE2  | ... -->| TEn  |--> Cf'
285       |  |      |   |      |   | |      |        |      |
286       |  +------+   +------+   | +------+        +------+
287       +------------------------+
288
289    Figure 3.X.6
290
291    It is possible for the application mode for more than one texture
292    to refer to the identical parameter, for example, the FRONT
293    DIFFUSE material color.  Such conflicts are resolved by having the
294    lowest numbered, enabled, texture provide the color value and any
295    higher numbered textures are ignored.  Note that when the
296    application mode is FRAGMENT_LIGHTi_EXT, the TextureLightEXT
297    <pname> parameter must be considered and when the application mode
298    is FRAGMENT_MATERIAL_EXT that the <face> and <mode> parameters
299    for TextureMaterialEXT must be considered.  A partial overlap
300    with the TextureMaterialEXT <face> and <mode> parameter (e.g.,
301    FRONT,DIFFUSE and FRONT_AND_BACK,DIFFUSE) is treated as a
302    conflict.
303
304    If there is a conflict between a material parameter being substituted
305    through FragmentColorMaterialEXT and TextureMaterialEXT, then the color
306    value assocaiated with the texture is ignored and the pre-texture fragment
307    color value is substituted.
308
309
310Additions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations
311and the Framebuffer)
312
313Additions to Chapter 5 of the 1.1 Specification (Special Functions)
314
315Additions to Chapter 6 of the 1.1 Specification (State and State Requests)
316
317Additions to the GLX Specification
318
319    None
320
321GLX Protocol
322
323    TBD
324
325Dependencies on EXT_fragment_lighting
326
327    EXT_fragment_lighting is required since this extension pertains to how
328    fragment lighting computations are performed and this extension makes no
329    sense without fragment lighting.
330
331Dependencies on SGIX_color_range
332
333    <this is a note, not a true dependency -db>
334    The scale and bias of performed on colors when converting them
335    to fragment normals is done regardless of whether SGIX_color_range is
336    supported.
337
338Dependencies on EXT_multitexture
339
340    If EXT_multitexture is not supported only the single
341    post-texture-environment color is available for substitution and the
342    discussion of multiple textures in section 3.X.4 is void.
343
344Dependencies on SGIX_shadow
345
346    If SGIX_shadow is not supported then this extension does not define
347    the attenuation multiplier term SHADOW_ATTENUATION_EXT.  All discussion
348    of this attenuation term is void.
349
350Errors
351
352    INVALID_ENUM is generated if ApplyTextureEXT parameter <mode> is
353    not FRAGMENT_MATERIAL_EXT, FRAGMENT_LIGHT0_EXT
354    .. FRAGMENT_LIGHTn_EXT (where n is the value returned by querying
355    MAX_FRAGMENT_LIGHTS_EXT), FRAGMENT_NORMAL_EXT,
356    FRAGMENT_DEPTH_EXT, or FRAGMENT_COLOR_EXT.
357
358    INVALID_ENUM is generated if TextureLightEXT parameter <pname> is
359    not AMBIENT, DIFFUSE, SPECULAR, ATTENUATION_EXT, or
360    SHADOW_ATTENUATION_EXT.
361
362    INVALID_ENUM is generated if TextureMaterialEXT parameter <face>
363    is not FRONT, BACK, or FRONT_AND_BACK or if parameter <mode> is
364    not EMISSION, AMBIENT, DIFFUSE, SPECULAR, SHININESS, or
365    AMBIENT_AND_DIFFUSE.
366
367    INVALID_OPERATION is generated if ApplyTextureEXT,
368    TextureLightEXT, or TextureMaterialEXT is executed between
369    execution of Begin and the corresponding execution of End.
370
371New State
372
373    Get Value                           Get Command     Type    Initial Value       Attribute
374    ---------                           -----------     ----    -------------       ---------
375    TEXTURE_APPLICATION_MODE_EXT        GetIntegerv     Z10     FRAGMENT_COLOR_EXT  texture
376    TEXTURE_LIGHT_EXT                   GetIntegerv     Z5      DIFFUSE             texture
377    TEXTURE_MATERIAL_FACE_EXT           GetIntegerv     Z3      FRONT_AND_BACK      texture
378    TEXTURE_MATERIAL_PARAMETER_EXT      GetIntegerv     Z6      AMBIENT_AND_DIFFUSE texture
379
380New Implementation Dependent State
381
382    None
383