• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3     EXT_texenv_op
4
5Name Strings
6
7     GL_EXT_texenv_op
8
9Contact
10
11     Tom Frisinger (tfrisinger 'at' atitech.com)
12     Michael Gold (gold 'at' nvidia.com)
13
14Status
15
16    XXX - Not complete yet!!!
17
18Version
19
20    $Date: 1999/12/28 01:40:34 $ $Revision: 1.4 $
21    ATI Date: 1999/03/02 12:00:00  Revision: 1.1
22
23Number
24
25     XXX
26
27Dependencies
28
29    OpenGL 1.1 is required.
30    ARB_multitexture is required.
31    This specification is written against the OpenGL 1.2 specification.
32
33Overview
34
35     The EXT_texenv_op extension defines a more expressive means for
36     programming the operations performed by the texture environment. It
37     defines new texture environment equations and allows explicit control
38     over the operands to the new equations. This explicit control can be
39     independently applied to the alpha and RGB color fragments.
40
41Issues
42
43   * Should we include f, iv, and fv versions of the TexEnvOperand call.
44
45        No, there seems to be no compelling reason to do so.
46
47   * Should we try to wrap this entire interface into TexEnv or at least
48     the specification of the operation?
49
50        Move operation specification into TexEnv, but keep TexEnvOperandiEXT
51        for operand specification.
52
53   * Should a stage argument be added to TexEnvOperandiEXT to decouple from
54     the current unit selector?
55
56        No. This goes against the ARB_multitexture implementation. We
57        have however allowed TEXTUREn_ARB as a value to the source
58        parameter of TexEnvOperandiEXT. This allows the texture fragment
59        to come from the texture bound to any legal texture unit stage.
60
61   * Should a generic scale and bias term be added?
62
63        Allow scales of 1.0, 2.0, and 4.0 to be applied to the output of
64        each stage. The scales can be independently applied to RGB and
65        Alpha. Generic biasing isn't allowed. However the ADD_SIGNED_EXT
66        operation effectively allows a bias of -0.5.
67
68   * Should alpha and RGB operands be completely orthogonal?
69
70     Yes.
71
72   * This spec becomes much more powerful when ARB_multitexture is
73     available. However, it seemed like having the new texture environment
74     functions and control over operands available to implementations that
75     don't support ARB_multitexture could be useful.
76
77        Make ARB_multitexture required. We define PREVIOUS_EXT to be
78        INCOMING_EXT for the texture unit 0 case so we could loosen up the
79        spec if need be.
80
81   * IDENTITY_EXT and ONE_MINUS_EXT are the legal values to the mapping
82     parameter of TexEnvOperandiEXT. Other names such as COPY, INVERT, or
83     COMPLEMENT_EXT may or may not be more appropriate.
84
85        Keep IDENTITY_EXT and ONE_MINUS_EXT they seem to be as good as any.
86
87   * Should a third operand be introduced such that the blending operations
88     could be generalized to the following equation?
89
90       Cv = CopA*(1- CopC) + CopB* CopC
91
92        Yes, this is the INTERPOLATE_EXT operation. Interpolation in the
93        alpha channel is also permitted.
94
95  *  Should we make the OpenGL 1.1 modes programmable? For example should
96     setting the env. mode to MODULATE have the effect of changing the
97     TEXTURE_ENV_MODE_ALPHA_EXT, TEXTURE_ENV_MODE_RGB_EXT, OPERANDS, and
98     possibly the OPERATIONS to a given state that would correspond with
99     tables 3.18 and 3.19?
100
101        Instead of this approach, we decided to go with the
102        non-programmable approach. For example MODULATE works as it
103        always did according to table 3.18 and 3.19 and does not change
104        TEXTURE_ENV_MODE_ALPHA_EXT, TEXTURE_ENV_MODE_RGB_EXT, OPERAND,
105        or OPERATION state. This adds a small amount of burden to the
106        driver but seems more consistent.
107
108   * ALPHA_SCALE and RGB_SCALE_EXT accept only 1.0, 2.0 and 4.0. This look
109     like we are really doing a shift. Should the value be restricted to an
110     integer and indicate a shift instead of a scale?
111
112        There is no reason to limit the domain of SCALE to an integer,
113        even if we only support integral values today. Lets keep it a
114        floating point value to allow future generalization.
115
116New Procedures and Functions
117
118     void TexEnvOperandiEXT(enum pname, int source, int mapping,
119                            int component);
120
121     void GetTexEnvOperandivEXT(enum pname, enum query, int *param);
122
123New Tokens
124
125     Accepted by <pname> parameter of TexEnvf, TexEnvi, TexEnvfv, TexEnviv,
126     GetTexEnviv, and GetTexEnvfv:
127
128        TEXTURE_ENV_MODE_ALPHA_EXT                    0x8570
129        TEXTURE_ENV_MODE_RGB_EXT                      0x8571
130        RGB_SCALE_EXT                                 0x8572
131        ALPHA_OPERATION_EXT                           0x8590
132        RGB_OPERATION_EXT                             0x8598
133
134     Accepted by the <param> parameter of TexEnvf, TexEnvi, TexEnvfv, and
135     TexEnviv when the <pname> parameter is TEXTURE_ENV_MODE,
136     TEXTURE_ENV_MODE_ALPHA_EXT, or TEXTURE_ENV_MODE_RGB_EXT:
137
138        A_TIMES_B_OP_C_EXT                            0x8573
139        INTERPOLATE_EXT                               0x8574
140
141     Accepted by the <param> parameter of TexEnvf, TexEnvi, TexEnvfv, and
142     TexEnviv when the <pname> parameter is ALPHA_OPERATION_EXT or
143     RGB_OPERATION_EXT:
144
145        ADD_SIGNED_EXT                                0x8575
146        SUTRACT_EXT                                   0x8576
147
148     Accepted by the <pname> parameter of TexEnvOperandiEXT and
149     GetTexEnvOperandivEXT:
150
151        ALPHA_OPERAND_A_EXT                           0x8580
152        ALPHA_OPERAND_B_EXT                           0x8581
153        ALPHA_OPERAND_C_EXT                           0x8582
154        RGB_OPERAND_A_EXT                             0x8588
155        RGB_OPERAND_B_EXT                             0x8589
156        RGB_OPERAND_C_EXT                             0x858A
157
158     Accepted by the source parameter to TexEnvOperandiExt:
159
160        CONSTANT_EXT                                  0x8577
161        INCOMING_EXT                                  0x8578
162        PREVIOUS_EXT                                  0x8579
163
164     Accepted by the mapping parameter to TexEnvOperandiExt:
165
166        IDENTITY_EXT                                  0x857A
167        ONE_MINUS_EXT                                 0x857B
168
169     Accepted by the query parameter to GetTexEnvOperandivEXT:
170
171        SOURCE_EXT                                    0x857C
172        MAPPING_EXT                                   0x857D
173        COMPONENT_EXT                                 0x857E
174
175Additions to Chapter 1 of the GL Specification (Introduction)
176
177     None
178
179Additions to Chapter 2 of the GL Specification (OpenGL Operation)
180
181     None
182
183Additions to Chapter 3 of the GL Specification (Rasterization)
184
185     Function             Operation         Equation
186     --------             ---------         --------
187     INTERPOLATE_EXT                        Av = AopA * (1-AopC) + AopB * AopC
188     A_TIMES_B_OP_C_EXT   ADD               Av = AopA * AopB + AopC
189                          ADD_SIGNED_EXT    Av = AopA * AopB + AopC - 0.5
190                          SUBTRACT_EXT      Av = AopA * AopB - AopC
191
192     Table 3.20: Alpha texture environment functions, operations and equations
193
194
195     Function             Operation         Equation
196     --------             ---------         --------
197     INTERPOLATE_EXT                        Cv = CopA * (1-CopC) + CopB * CopC
198     A_TIMES_B_OP_C_EXT   ADD               Cv = CopA * CopB + CopC
199                          ADD_SIGNED_EXT    Cv = CopA * CopB + CopC - 0.5
200                          SUBTRACT_EXT      Cv = CopA * CopB - CopC
201
202     Table 3.21: RGB texture environment functions, operations and equations
203
204
205     Operand                     Source             Mapping          Component
206     -------                     ------             -------          ---------
207     ALPHA_OPERAND_A_EXT         TEXTURE            IDENTITY_EXT     ALPHA
208     ALPHA_OPERAND_B_EXT         TEXTUREn_ARB       ONE_MINUS_EXT
209     ALPHA_OPERAND_C_EXT         CONSTANT_EXT
210                                 INCOMING_EXT
211                                 PREVIOUS_EXT
212                                 ZERO
213     RGB_OPERAND_A_EXT           TEXTURE            IDENTITY_EXT     ALPHA
214     RGB_OPERAND_B_EXT           TEXTUREn_ARB       ONE_MINUS_EXT    RGB
215     RGB_OPERAND_C_EXT           CONSTANT_EXT
216                                 INCOMING_EXT
217                                 PREVIOUS_EXT
218                                 ZERO
219
220     Table 3.22: Inputs to TexEnvOperandiEXT
221
222
223     Texture                          LUMINANCE
224     Format      ALPHA     LUMINANCE    ALPHA     INTENSITY   RGB    RGBA
225     -------     -----     ---------  ----------  ---------   ---    ----
226     RGB          1.0       Lt         Lt          It          Ct     Ct
227     ALPHA        At        1.0        At          It          1.0    At
228
229     Table 3.23: Texture fragment sources
230
2313.8.9 Texture Environments and Texture Functions
232
233     The command
234
235        void TexEnv{if}( enum target, enum pname, T param ) ;
236        void TexEnv{if}v( enum target, enum pname, T params ) ;
237
238     sets parameters of the texture environment that specifies how texture
239     values are interpreted when texturing a fragment. target must
240     currently be the symbolic constant TEXTURE_ENV. pname is a symbolic
241     constant indicating the parameter to be set. In the first form of the
242     command, param is a value to which to set a single-valued parameter;
243     in the second form, params is a pointer to an array of parameters:
244     either a single symbolic constant or a value or group of values to
245     which the parameter should be set. The possible environment parameters
246     are TEXTURE_ENV_MODE, TEXTURE_ENV_MODE_ALPHA_EXT,
247     TEXTURE_ENV_MODE_RGB_EXT, ALPHA_OPERATION_EXT, RGB_OPERATION_EXT,
248     ALPHA_SCALE_EXT, RGB_SCALE_EXT, and TEXTURE_ENV_COLOR.
249     TEXTURE_ENV_MODE, TEXTURE_ENV_MODE_ALPHA_EXT, and
250     TEXTURE_ENV_MODE_RGB_EXT may be set to one of REPLACE, MODULATE,
251     DECAL, BLEND, A_TIMES_B_OP_C_EXT, or INTERPOLATE_EXT;
252     ALPHA_OPERATION_EXT and RGB_OPERATION_EXT may be set to one of ADD,
253     ADD_SIGNED_EXT, SUBTRACT_EXT; ALPHA_SCALE and RGB_SCALE_EXT are
254     single-precision floating point values that may have a value of 1.0,
255     2.0, or 4.0. TEXTURE_ENV_COLOR is set to an RGBA color providing four
256     single-precision floating-point values in the range [0, 1] (values
257     outside this range are clamped to it). If integers are provided for
258     TEXTURE_ENV_COLOR, then they are converted to floating-point as
259     specified in table 2.6 for signed integers.
260
261     The value of TEXTURE_ENV_MODE specifies an implicit texture function
262     if it is REPLACE, MODULATE, DECAL, or BLEND. The result of this
263     function depends on the fragment and the texture array value. The
264     precise form of the function depends on the base internal formats of
265     the texture arrays that were last specified. In the following two
266     tables, Rf, Gf, Bf, and Af are the primary color components of the
267     incoming fragment; Rt, Gt, Bt, At, Lt, and It are the filtered texture
268     values; Rc, Gc, Bc, and Ac are the texture environment color values;
269     and Rv, Gv, Bv, and Av are the primary color components computed by
270     the texture function. All of these color values are in the range [0,
271     1]. The REPLACE and MODULATE texture functions are specified in table
272     3.18, and the DECAL and BLEND texture functions are specified in table
273     3.19.
274
275     The texture function used to generate the Alpha component (Av) and the
276     RGB component (Rv, Gv, Bv) can be independently specified using
277     TEXTURE_ENV_MODE_ALPHA_EXT and TEXTURE_ENV_MODE_RGB_EXT respectively.
278     The alpha component will be computed in accordance to the alpha
279     equation for the given alpha texture function as specified in tables
280     3.18 and 3.19. The RGB components will be computed in accordance to
281     the RGB equations for the given RGB texture function as specified in
282     tables 3.18 and 3.19. Queries to TEXTURE_ENV_MODE are supported for
283     compatibility and are equivalent to querying TEXTURE_ENV_MODE_RGB_EXT.
284
285     The value of TEXTURE_ENV_MODE, TEXTURE_ENV_MODE_ALPHA_EXT, or
286     TEXTURE_ENV_MODE_RGB_EXT specifies an explicit texture function if it
287     is INTERPOLATE_EXT or A_TIMES_B_OP_C_EXT. Specifying TEXTURE_ENV_MODE
288     with a value of INTERPOLATE_EXT or A_TIMES_B_OP_C_EXT will result in
289     the setting of both TEXTURE_ENV_MODE_ALPHA_EXT and
290     TEXTURE_ENV_MODE_RGB_EXT to the given value. The result of this
291     function depends on the currently selected operands and in the case of
292     A_TIMES_B_OP_C_EXT the operation. In tables 3.20, 3.21, 3.22, and 3.23
293     the following variables are used:
294
295     AopA = ALPHA_OPERAND_A_EXT
296     AopB = ALPHA_OPERAND_B_EXT
297     AopC = ALPHA_OPERAND_C_EXT
298     CopA = RGB_OPERAND_A_EXT
299     CopB = RGB_OPERAND_B_EXT
300     CopC = RGB_OPERAND_C_EXT
301
302     All of these color and alpha values are clamped to the range [0,1].
303
304     and:
305
306     Ac, Af, At, Av, Ct, It, and Lt have the same meaning as in tables 3.18
307     and 3.19.
308
309     See tables 3.20 and 3.21 for the specifics of the texture functions.
310
311     ALPHA_OPERATION_EXT specifies the texture environment operation to be
312     applied to the alpha component of the color fragment.
313     RGB_OPERATION_EXT specifies the texture environment operation to be
314     applied to the RGB component of the color fragment. This operation is
315     only applicable when the texture environment mode is A_TIMES_B_OP_C
316     and can have a value of ADD, ADD_SIGNED_EXT, or SUBTRACT_EXT. See
317     tables 3.20 and 3.21 for texture operation equations.
318
319     The values for ALPHA_SCALE and RGB_SCALE_EXT specify the amount of
320     scaling to be applied to the Alpha and RGB output of each texture unit
321     stage. Valid values are 1.0, 2.0, and 4.0. Scaling happens prior to
322     clamping of Rv, Gv, Bv, and Av to the range [0,1].
323
324     The command
325
326        void TexEnvOperandiEXT(enum pname, int source, int mapping, int
327                               component);
328
329     is used to set the operands to the texture function operation. <pname>
330     is a symbolic constant indicating the parameter to be set; the
331     possible constants and corresponding parameters are summarized in
332     table 3.22.
333
334     When <pname> is set to ALPHA_OPERAND_l_EXT, the alpha component of
335     operand l is modified. When <pname> is set to RGB_OPERAND_l_EXT, the RGB
336     component of operand l is modified.
337
338     <source> specifies the source of the operand data. TEXTURE specifies to
339     use the filtered texture fragment from the current texture unit as an
340     operand. TEXTUREn_ARB specifies to use the filtered texture fragment
341     from the nth texture unit. When <source> is set to TEXTURE or
342     TEXTUREn_ARB the value of the texture fragment depends on the base
343     internal formats of the texture arrays that were last specified (see
344     Table 3.23). CONSTANT_EXT specifies to use the constant texture
345     environment color as the fragment. INCOMING_EXT specifies to use the
346     incoming fragment color. PREVIOUS_EXT indicates that the input to the
347     operand comes from the specified output of the previous texture unit.
348     If the current selected texture unit is texture unit 0, then
349     PREVIOUS_EXT has the same meaning as INCOMING_EXT (i.e. the input to
350     operand is the incoming fragment).
351
352     <mapping> specifies what operation will be done to the source fragment
353     prior to its use as an operand. IDENTITY_EXT specifies that no
354     operation will be done on the fragment. ONE_MINUS specifies that 1.0
355     minus the fragment color will be used as an operand.
356
357     <component> specifies which part of the source fragment color to use.
358     <component> must be ALPHA when pname is ALPHA_OPERAND_l_EXT. Valid
359     values for <component> are ALPHA and RGB when <pname> is
360     RGB_OPERAND_l_EXT.
361
362     The state required for the current texture environment consists of two
363     six-valued integers indicating the texture rgb and alpha functions;
364     the four floating-point TEXTURE_ENV_COLOR values; two three-valued
365     integers representing the RGB and ALPHA operations; two floating point
366     RGB_SCALE_EXT and ALPHA_SCALE values; six n-valued integers
367     representing the RGB and ALPHA OPERAND A,B and C values, where n
368     equals five plus the number of texture units; six two-valued integers
369     representing the operand mappings; and three two-valued integers
370     representing the component selection of the RGB_OPERANDs. In the
371     initial state, the texture RGB and ALPHA functions are MODULATE; the
372     TEXTURE_ENV_COLOR is (0,0,0,0); the RGB and ALPHA operations are ADD;
373     the RGB and ALPHA scales are 1.0; the RGB_OPERAND_A_EXT and
374     ALPHA_OPERAND_A_EXT sources are both PREVIOUS_EXT; the
375     RGB_OPERAND_B_EXT and ALPHA_OPERAND_B_EXT sources are both TEXTURE;
376     the RGB_OPERAND_C_EXT and ALPHA_OPERAND_C_EXT sources are both ZERO;
377     all operand mappings are IDENTITY_EXT; all RGB operand components are
378     RGB; and all ALPHA operand mappings are ALPHA.
379
380Additions to Chapter 4 of the GL Specification (Per-Fragment
381Operations and the Framebuffer)
382
383     None
384
385Additions to Chapter 5 of the GL Specification (Special Functions)
386
387     None
388
389Additions to Chapter 6 of the GL Specification (State and State Requests)
390
391     3. Enumerated Queries
392
393        void GetTexEnvOperandivEXT(enum pname, enum query, int *param);
394
395     GetTexEnvOperandivEXT places information about <query> (a symbolic
396     constant) for <pname> (also symbolic constant) in <param>.
397
398Additions to the GLX Specification
399
400     None
401
402GLX Protocol
403
404     TBD
405
406Errors
407
408     INVALID_ENUM is generated when target or pname parameters of TexEnvi
409     or TexEnvf are not one of the accepted defined values, or when params
410     should have a defined constant value (based on the value of pname) and
411     does not.
412
413     INVALID_ENUM is generated when pname, source, mapping, or component
414     parameters of TexEnvOperandiEXT are not one of the accepted defined
415     values.
416
417     INVALID_ENUM is generated when pname parameter of
418     GetTexEnvOperandEXTiv is not one of the accepted defined values.
419
420     INVALID_OPERATION is generated if TexEnvOperandiEXT, or
421     GetTexEnvOperandivEXT are executed between execution of Begin and the
422     corresponding execution of End.
423
424New State
425
426     All new state belongs to Section 3.8.9. All new state has an attribute
427     of 'texture'. These are additions/modifications to table 6.14.
428
429
430  Get Value                   Type   Get Command            Initial Value
431  ---------                   ----   -----------            ------------
432  TEXTURE_ENV_MODE_ALPHA_EXT  Z6     GetTexEnviv            MODULATE
433  TEXTURE_ENV_MODE_RGB_EXT    Z6     GetTexEnviv            MODULATE
434  ALPHA_SCALE                 R      GetTexEnvfv            1.0
435  RGB_SCALE_EXT               R      GetTexEnvfv            1.0
436  ALPHA_OPERATION_EXT         Z3     GetTexEnviv            ADD
437  RGB_OPERATION_EXT           Z3     GetTexEnviv            ADD
438  SOURCE_EXT                  6 X    GetTexEnvOperandivEXT  PREVIOUS_EXT for
439                              Z6                            ALPHA_OPERAND_A_EXT
440
441                                                            PREVIOUS_EXT for
442                                                            RGB_OPERAND_A_EXT
443
444                                                            TEXTURE for
445                                                            ALPHA_OPERAND_B_EXT
446
447                                                            TEXTURE for
448                                                            RGB_OPERAND_B_EXT
449
450                                                            ZERO for
451                                                            ALPHA_OPERAND_C_EXT
452
453                                                            ZERO for
454                                                            RGB_OPERAND_C_EXT
455
456  MAPPING_EXT                 6 X    GetTexEnvOperandivEXT  IDENTITY_EXT for
457                              Z2                            ALPHA_OPERAND_A_EXT
458
459                                                            IDENTITY_EXT for
460                                                            RGB_OPERAND_A_EXT
461
462                                                            IDENTITY_EXT for
463                                                            ALPHA_OPERAND_B_EXT
464
465                                                            IDENTITY_EXT for
466                                                            RGB_OPERAND_B_EXT
467
468                                                            IDENTITY_EXT for
469                                                            ALPHA_OPERAND_C_EXT
470
471                                                            IDENTITY_EXT for
472                                                            RGB_OPERAND_C_EXT
473
474  COMPONENT_EXT               6 X    GetTexEnvOperandivEXT  ALPHA for
475                              Z2                            ALPHA_OPERAND_A_EXT
476
477                                                            RGB for
478                                                            RGB_OPERAND_A_EXT
479
480                                                            ALPHA for
481                                                            ALPHA_OPERAND_B_EXT
482
483                                                            RGB for
484                                                            RGB_OPERAND_B_EXT
485
486                                                            ALPHA for
487                                                            ALPHA_OPERAND_C_EXT
488
489                                                            RGB for
490                                                            RGB_OPERAND_C_EXT
491
492     Table 6.14: Texture Environment and Generation
493
494New Implementation Dependent State
495
496     None
497