15bd8deadSopenharmony_ciName
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ci    EXT_texture_env
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName Strings
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    GL_EXT_texture_env
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciVersion
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    $Date: 1998/05/12 23:52:26 $ $Revision: 1.5 $
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciNumber
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    146
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciDependencies
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    OpenGL 1.1 is required.
205bd8deadSopenharmony_ci    OpenGL 1.2 affects the definition of this spec.
215bd8deadSopenharmony_ci    EXT_multitexture affects the definition of this spec.
225bd8deadSopenharmony_ci    This specification is written against the OpenGL 1.2 specification.
235bd8deadSopenharmony_ci
245bd8deadSopenharmony_ciOverview
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    A new texture environment is defined which supports the
275bd8deadSopenharmony_ci    following equations:
285bd8deadSopenharmony_ci
295bd8deadSopenharmony_ci                        Cv = Cf                 COPY
305bd8deadSopenharmony_ci                        Cv = Ct                 REPLACE
315bd8deadSopenharmony_ci                        Cv = Cf * Ct            MODULATE
325bd8deadSopenharmony_ci                        Cv = Cf + Ct            ADD
335bd8deadSopenharmony_ci                        Cv = Cf - Ct            SUBTRACT
345bd8deadSopenharmony_ci                        Cv = Ct - Cf            REVERSE_SUBTRACT
355bd8deadSopenharmony_ci                        Cv = aCf + (1-a)Ct      BLEND
365bd8deadSopenharmony_ci                        Cv = aCt + (1-a)Cf      REVERSE_BLEND
375bd8deadSopenharmony_ci        where a is the incoming fragment's alpha value
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    These functions may be independently selected for color and alpha
405bd8deadSopenharmony_ci    processing.  The BLEND function is not available for alpha processing.
415bd8deadSopenharmony_ci    Additionally a scale factor of 2^0, 2^1, or 2^2 may be applied to the final
425bd8deadSopenharmony_ci    result.
435bd8deadSopenharmony_ci
445bd8deadSopenharmony_ciIssues
455bd8deadSopenharmony_ci
465bd8deadSopenharmony_ci  * The functions are added as a `suite' in a new texture environment.  An
475bd8deadSopenharmony_ci    alternative would be to retrofit them into the existing texture
485bd8deadSopenharmony_ci    environment.  There would likely be a clash with SGIX_texture_add_env
495bd8deadSopenharmony_ci    and with the DECAL/BLEND environment which are similar yet different
505bd8deadSopenharmony_ci    from the new BLEND function.  Also the separate specification of
515bd8deadSopenharmony_ci    the alpha texture function seems awkward, and we specified a new 
525bd8deadSopenharmony_ci    behavior for the new texture environment when texturing is disabled.
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci  * I chose the name EXT_texture_env as it really is an extension to
555bd8deadSopenharmony_ci    texture environment to add a new environment.  Should it have some
565bd8deadSopenharmony_ci    other name, e.g., EXT_texture_env1?
575bd8deadSopenharmony_ci
585bd8deadSopenharmony_ci  * A new enable is defined for TEXTURE_ENV1_EXT which causes it to
595bd8deadSopenharmony_ci    be activated over TEXTURE_ENV.  No enable is defined for TEXTURE_ENV
605bd8deadSopenharmony_ci    as it is considered to be enabled always.  The OpenGL spec uses
615bd8deadSopenharmony_ci    the term 'currently bound environment' should we be doing something
625bd8deadSopenharmony_ci    that looks more bind like or changing the language to something like
635bd8deadSopenharmony_ci    currently selected/enabled environment?
645bd8deadSopenharmony_ci
655bd8deadSopenharmony_ci  * There is no constant color term in TEXTURE_ENV1_EXT.  The functionality
665bd8deadSopenharmony_ci    is still available in TEXTURE_ENV and I'm not sure there is a compelling
675bd8deadSopenharmony_ci    reason to integrate the constant term here.
685bd8deadSopenharmony_ci
695bd8deadSopenharmony_ci  * The BLEND function is fairly restrictive.  Should it be more general?
705bd8deadSopenharmony_ci    e.g. reverse the blending factor?
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    Resolved: YES.  add REVERSE_BLEND.
735bd8deadSopenharmony_ci
745bd8deadSopenharmony_ci  * The rules for alpha-only and alpha-less textures are very regular
755bd8deadSopenharmony_ci    the color components of an alpha-only texture are substituted with zero
765bd8deadSopenharmony_ci    and the alpha component of an alpha-less texture is substituted with one.
775bd8deadSopenharmony_ci    Are these the right rules?
785bd8deadSopenharmony_ci
795bd8deadSopenharmony_ci  * If texturing is disabled, environment computations are still
805bd8deadSopenharmony_ci    performed in this new texture environment, whereas they are not in the
815bd8deadSopenharmony_ci    old environment (to preserve compatibility).  This sets the stage for
825bd8deadSopenharmony_ci    texture environments performing functions which do not involve a
835bd8deadSopenharmony_ci    texture though perhaps it is a little awkward.
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ci  * Enumerants are screwy.  Should we add new _EXT enumerants for
865bd8deadSopenharmony_ci    COPY, REPLACE, ADD, MODULATE, BLEND, as was done for the original
875bd8deadSopenharmony_ci    texture extension or reuse these existing tokens and just add
885bd8deadSopenharmony_ci    SUBTRACT, REVERSE_SUBTRACT, and REVERSE_BLEND?
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ci    I chose to add new enumerants which are prefixed with ENV_. The
915bd8deadSopenharmony_ci    main reason is to allow them to have contiguous values and leave
925bd8deadSopenharmony_ci    some room for expansion to ensure that they can be switched
935bd8deadSopenharmony_ci    with minimal parameter validation cost.
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci  * Should a scale & bias be defined as part of this extension or
965bd8deadSopenharmony_ci    as a separate add-on to the environment processing?
975bd8deadSopenharmony_ci
985bd8deadSopenharmony_ci  * Possible add-on extensions (in the context of multitexture):
995bd8deadSopenharmony_ci
1005bd8deadSopenharmony_ci        1) source and blend factor specification for the BLEND/REVERSE_BLEND
1015bd8deadSopenharmony_ci           functions by generalizing BLEND/REVERSE_BLEND to 
1025bd8deadSopenharmony_ci                x*Cf + y*Ct   /    x*Ct + y*Cf
1035bd8deadSopenharmony_ci           and allow x to be specified by TEXTURE_ENV_SRC_FACTOR and
1045bd8deadSopenharmony_ci           y by TEXTURE_ENV_DST_FACTOR with possible src and dst factors
1055bd8deadSopenharmony_ci           ONE
1065bd8deadSopenharmony_ci           ZERO
1075bd8deadSopenharmony_ci           FRAGMENT_ALPHA    alpha from previous environment stage
1085bd8deadSopenharmony_ci           TEXTURE_ALPHA     alpha from texture
1095bd8deadSopenharmony_ci           PRETEXTURE_ALPHA  original pre-texture alpha value
1105bd8deadSopenharmony_ci           FRAGMENT_ALPHA_MINUS_ONE
1115bd8deadSopenharmony_ci           TEXTURE_ALPHA_MINUS_ONE
1125bd8deadSopenharmony_ci           PRETEXTURE_ALPHA_MINUS_ONE
1135bd8deadSopenharmony_ci        
1145bd8deadSopenharmony_ci        2) Add some muxing to the inputs of the equations.
1155bd8deadSopenharmony_ci           The basic equation set is
1165bd8deadSopenharmony_ci                Cf            (copy)
1175bd8deadSopenharmony_ci                Cf*Ct         (modulate)
1185bd8deadSopenharmony_ci                Cf+Ct         (add/sub/rsub)
1195bd8deadSopenharmony_ci                a*Cf+(1-a)*Ct (blend/rblend)
1205bd8deadSopenharmony_ci            
1215bd8deadSopenharmony_ci            so allow a more flexible binding on Cf & Ct
1225bd8deadSopenharmony_ci            TEXTURE_ENV_SRC  (default is FRAGMENT)
1235bd8deadSopenharmony_ci            TEXTURE_ENV_DST  (default is TEXTURE)
1245bd8deadSopenharmony_ci                choices:
1255bd8deadSopenharmony_ci                    FRAGMENT
1265bd8deadSopenharmony_ci                    TEXTURE
1275bd8deadSopenharmony_ci                    PRETEXTURE
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci         3) extension 2) gives a good chunk of the functionality of 1)
1305bd8deadSopenharmony_ci            perhaps we could avoid 1) altogether or change 1) to allow
1315bd8deadSopenharmony_ci            a more restrictive selection of the blend factor (simultaneously
1325bd8deadSopenharmony_ci            choosing both a and (1-a):
1335bd8deadSopenharmony_ci
1345bd8deadSopenharmony_ci            TEXTURE_ENV_BLEND_FACTOR
1355bd8deadSopenharmony_ci                choices:
1365bd8deadSopenharmony_ci                    FRAGMENT
1375bd8deadSopenharmony_ci                    TEXTURE
1385bd8deadSopenharmony_ci                    PRETEXTURE
1395bd8deadSopenharmony_ci
1405bd8deadSopenharmony_ci
1415bd8deadSopenharmony_ciNew Procedures and Functions
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    None
1445bd8deadSopenharmony_ci
1455bd8deadSopenharmony_ciNew Tokens
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    Accepted by the <target> parameter of TexEnvf, TexEnvi, TexEnvfv, TexEnvfi,
1485bd8deadSopenharmony_ci    GetTexEnviv, GetTexEnvfv, GetBooleanv, GetIntegerv, GetFloatv, GetDoublev,
1495bd8deadSopenharmony_ci    and the <cap> parameter of Enable, Disable, and IsEnabled
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    TEXTURE_ENV0_EXT            0x????
1525bd8deadSopenharmony_ci    TEXTURE_ENV1_EXT            TEXTURE_ENV0_EXT+1
1535bd8deadSopenharmony_ci    <leave room for 14 more environments>
1545bd8deadSopenharmony_ci
1555bd8deadSopenharmony_ci    Accepted by the <pname> parameter of TexEnvf, TexEnvi, TexEnvfv, TexEnvfi,
1565bd8deadSopenharmony_ci    GetTexEnviv and GetTexEnvfv when the <target> parameter value is
1575bd8deadSopenharmony_ci    TEXTURE_ENV1_EXT
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    TEXTURE_ENV_MODE_ALPHA_EXT  0x????
1605bd8deadSopenharmony_ci
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Accepted by the <params> parameter of TexEnvf, TexEnvi, TexEnvfv, and
1635bd8deadSopenharmony_ci    TexEnvfi when the <target> parameter value is TEXTURE_ENV1_EXT and the
1645bd8deadSopenharmony_ci    <pname> parameter value is TEXTURE_ENV_MODE or
1655bd8deadSopenharmony_ci    TEXTURE_ENV_MODE_ALPHA_EXT
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    ENV_COPY_EXT                0x????
1685bd8deadSopenharmony_ci    ENV_REPLACE_EXT             0x????
1695bd8deadSopenharmony_ci    ENV_MODULATE_EXT            0x????
1705bd8deadSopenharmony_ci    ENV_ADD_EXT                 0x????
1715bd8deadSopenharmony_ci    ENV_SUBTRACT_EXT            0x????
1725bd8deadSopenharmony_ci    ENV_REVERSE_SUBTRACT_EXT    0x????
1735bd8deadSopenharmony_ci    ENV_BLEND_EXT               0x????
1745bd8deadSopenharmony_ci    ENV_REVERSE_BLEND_EXT       0x????
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    Accepted by the <pname> parameter of TexEnvf, TexEnvi, TexEnvfv, 
1775bd8deadSopenharmony_ci    TexEnvfi, GetTexEnviv, and GetTexEnvfv
1785bd8deadSopenharmony_ci
1795bd8deadSopenharmony_ci    TEXTURE_ENV_SHIFT_EXT       0x????
1805bd8deadSopenharmony_ci
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci
1835bd8deadSopenharmony_ciAdditions to Chapter 2 of the GL Specification (OpenGL Operation)
1845bd8deadSopenharmony_ci
1855bd8deadSopenharmony_ci        None
1865bd8deadSopenharmony_ci
1875bd8deadSopenharmony_ciAdditions to Chapter 3 of the GL Specification (Rasterization)
1885bd8deadSopenharmony_ci
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci
1915bd8deadSopenharmony_ci
1925bd8deadSopenharmony_ci                                Texture Environment 1
1935bd8deadSopenharmony_ci                                ----------------------
1945bd8deadSopenharmony_ci
1955bd8deadSopenharmony_ci        Base Texture Format     COPY  REPLACE  MODULATE  ADD
1965bd8deadSopenharmony_ci        -------------------     ----  -------  --------  ---
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci        ALPHA                    Rf     0        Rf*0    Rf+0
1995bd8deadSopenharmony_ci                                 Gf     0        Gf*0    Rf+0
2005bd8deadSopenharmony_ci                                 Bf     0        Bf*0    Rf+0
2015bd8deadSopenharmony_ci                                 Af     At       Af*At   Af+At
2025bd8deadSopenharmony_ci
2035bd8deadSopenharmony_ci        LUMINANCE                Rf     Lt       Rf*Lt   Rf+Lt
2045bd8deadSopenharmony_ci                                 Gf     Lt       Gf*Lt   Gf+Lt
2055bd8deadSopenharmony_ci                                 Bf     Lt       Bf*Lt   Bf+Lt
2065bd8deadSopenharmony_ci                                 Af     1        Af*1    Af+1
2075bd8deadSopenharmony_ci
2085bd8deadSopenharmony_ci        LUMINANCE_ALPHA          Rf     Lt       Rf*Lt   Rf+Lt
2095bd8deadSopenharmony_ci                                 Gf     Lt       Gf*Lt   Gf+Lt
2105bd8deadSopenharmony_ci                                 Bf     Lt       Bf*Lt   Bf+Lt
2115bd8deadSopenharmony_ci                                 Af     At       Af*At   Af+At
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci        INTENSITY                Rf     It       Rf*It   Rf+It
2145bd8deadSopenharmony_ci                                 Gf     It       Gf*It   Gf+It
2155bd8deadSopenharmony_ci                                 Bf     It       Bf*It   Bf+It
2165bd8deadSopenharmony_ci                                 Af     It       Af*It   Af+It
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci        RGB                      Rf     Rt       Rf*Rt   Rf+Rt
2195bd8deadSopenharmony_ci                                 Gf     Gt       Gf*Gt   Gf+Gt
2205bd8deadSopenharmony_ci                                 Bf     Bt       Bf*Bt   Bf+Bt
2215bd8deadSopenharmony_ci                                 Af     1        Af*1    Af+1
2225bd8deadSopenharmony_ci
2235bd8deadSopenharmony_ci        RGBA                     Rf     Rt       Rf*Rt   Rf+Rt
2245bd8deadSopenharmony_ci                                 Gf     Gt       Gf*Gt   Gf+Gt
2255bd8deadSopenharmony_ci                                 Bf     Bt       Bf*Bt   Bf+Bt
2265bd8deadSopenharmony_ci                                 Af     At       Af*At   Af+At
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci
2295bd8deadSopenharmony_ci        Base Texture Format  SUBTRACT  REVERSE_      BLEND        REVERSE_
2305bd8deadSopenharmony_ci                                       SUBTRACT                   BLEND
2315bd8deadSopenharmony_ci        -------------------  --------  --------  ---------------  -------------
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci        ALPHA                Rf-0      0-Rf     Af*Rf+(1-Af)*0   Af*0+(1-Af)*Rf
2345bd8deadSopenharmony_ci                             Gf-0      0-Gf     Af*Gf+(1-Af)*0   Af*0+(1-Af)*Gf
2355bd8deadSopenharmony_ci                             Bf-0      0-Bf     Af*Bf+(1-Af)*0   Af*0+(1-Af)*Bf
2365bd8deadSopenharmony_ci                             Af-At     At-Af    N/A              N/A
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci        LUMINANCE            Rf-Lt     Lt-Rf    Af*Rf+(1-Af)*Lt  Af*Lt+(1-Af)*Rf
2395bd8deadSopenharmony_ci                             Gf-Lt     Lt-Gf    Af*Gf+(1-Af)*Lt  Af*Lt+(1-Af)*Gf
2405bd8deadSopenharmony_ci                             Bf-Lt     Lt-Bf    Af*Bf+(1-Af)*Lt  Af*Lt+(1-Af)*Bf
2415bd8deadSopenharmony_ci                             Af-1      1-Af     N/A              N/A
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci        LUMINANCE_ALPHA      Rf-Lt     Lt-Rf    Af*Rf+(1-Af)*Lt  Af*Lt+(1-Af)*Rf
2445bd8deadSopenharmony_ci                             Gf-Lt     Lt-Gf    Af*Gf+(1-Af)*Lt  Af*Lt+(1-Af)*Gf
2455bd8deadSopenharmony_ci                             Bf-Lt     Lt-Bf    Af*Bf+(1-Af)*Lt  Af*Lt+(1-Af)*Bf
2465bd8deadSopenharmony_ci                             Af-At     At-Af    N/A              N/A
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci        INTENSITY            Rf-It     It-Rf    Af*Rf+(1-Af)*It  Af*It+(1-Af)*Rf
2495bd8deadSopenharmony_ci                             Gf-It     It-Gf    Af*Gf+(1-Af)*It  Af*It+(1-Af)*Gf
2505bd8deadSopenharmony_ci                             Bf-It     It-Bf    Af*Bf+(1-Af)*It  Af*It+(1-Af)*Bf
2515bd8deadSopenharmony_ci                             Af-It     It-Af    N/A              N/A
2525bd8deadSopenharmony_ci
2535bd8deadSopenharmony_ci        RGB                  Rf-Rt     Rt-Rf    Af*Rf+(1-Af)*Rt  Af*Rt+(1-Af)*Rf
2545bd8deadSopenharmony_ci                             Gf-Gt     Gt-Gf    Af*Gf+(1-Af)*Gt  Af*Gt+(1-Af)*Gf
2555bd8deadSopenharmony_ci                             Bf-Bt     Bt-Bf    Af*Bf+(1-Af)*Bt  Af*Bt+(1-Af)*Bf
2565bd8deadSopenharmony_ci                             Af-1      1-Af     N/A              N/A
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ci        RGBA                 Rf-Rt     Rt-Rf    Af*Rf+(1-Af)*Rt  Af*Rt+(1-Af)*Rf
2595bd8deadSopenharmony_ci                             Gf-Gt     Gt-Gf    Af*Gf+(1-Af)*Gt  Af*Gt+(1-Af)*Gf
2605bd8deadSopenharmony_ci                             Bf-Bt     Bt-Bf    Af*Bf+(1-Af)*Bt  Af*Bt+(1-Af)*Bf
2615bd8deadSopenharmony_ci                             Af-At     At-Af    N/A              N/A
2625bd8deadSopenharmony_ci
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci        Tables 3.12 and 3.13: Texture functions for TEXTURE_ENV1.
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ci    Section 3.8.5 Texture Environments and Texture Functions
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci
2695bd8deadSopenharmony_ci    The command
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    void TexEnv{if}( enum target, enum pname, T param ) ;
2725bd8deadSopenharmony_ci    void TexEnv{if}v( enum target, enum pname, T params ) ;
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    sets parameters of the <texture environment> that specifies how texture
2755bd8deadSopenharmony_ci    values are interpreted when texturing a fragment.  <target> must be the
2765bd8deadSopenharmony_ci    symbolic constant TEXTURE_ENV0_EXT or TEXTURE_ENV1_EXT.  <pname> is a
2775bd8deadSopenharmony_ci    symbolic constant indicating the parameter to be set.  In the first form of
2785bd8deadSopenharmony_ci    the command, <param> is a value to which to set a single-valued parameter;
2795bd8deadSopenharmony_ci    in the second form, <params> is point to an array of parameters: either a
2805bd8deadSopenharmony_ci    single symbolic constant or a value or group of values to which the
2815bd8deadSopenharmony_ci    parameter should be set.  The possible environment parameters are
2825bd8deadSopenharmony_ci    TEXTURE_ENV_MODE, TEXTURE_ENV_COLOR, and TEXTURE_ENV_COORD_SET_EXT.
2835bd8deadSopenharmony_ci    TEXTURE_ENV_MODE may be set to one of REPLACE, MODULATE, DECAL, or BLEND;
2845bd8deadSopenharmony_ci    TEXTURE_ENV_COLOR is set to an RGBA color by providing four
2855bd8deadSopenharmony_ci    single-precision floating-point values in the range [0,1](values outside
2865bd8deadSopenharmony_ci    this range are clamped to it).  If integers are provided for
2875bd8deadSopenharmony_ci    TEXTURE_ENV_COLOR, then they are converted to floating-point as specified
2885bd8deadSopenharmony_ci    in Table 2.6 for signed integers.  TEXTURE_ENV_COORD_SET_EXT may be set to
2895bd8deadSopenharmony_ci    one of TEXTURE0_EXT .. TEXTURE<n>_EXT where <n> is one less than the
2905bd8deadSopenharmony_ci    number of supported texture coordinate sets.  If floating-point values
2915bd8deadSopenharmony_ci    are supplied, they are rounded to the nearest integer.
2925bd8deadSopenharmony_ci
2935bd8deadSopenharmony_ci        The value of TEXTURE_ENV_MODE specifies a texture function.  The result
2945bd8deadSopenharmony_ci    of this function depends on the fragment and the texture array value.  The
2955bd8deadSopenharmony_ci    precise form of the function depends on the base internal formats of the
2965bd8deadSopenharmony_ci    texture arrays that were last specified.  In the following two
2975bd8deadSopenharmony_ci    tables Rf, Gf, Bf, and Af are the color components of the incoming
2985bd8deadSopenharmony_ci    fragment; Rt, Gt, Bt, At, Lt, and It are the filtered texture values; Rc,
2995bd8deadSopenharmony_ci    Gc, Bc, and Ac are the texture environment color values; and Rv, Gv, Bv,
3005bd8deadSopenharmony_ci    and Av are the color components computed by the texture function.  All of
3015bd8deadSopenharmony_ci    these color values are in the range [0,1].  The REPLACE and MODULATE
3025bd8deadSopenharmony_ci    texture functions are specified in Table 3.10, and the DECAL and BLEND
3035bd8deadSopenharmony_ci    texture functions are specified in Table 3.11.
3045bd8deadSopenharmony_ci
3055bd8deadSopenharmony_ci        The value of TEXTURE_ENV_COORD_SET_EXT specifies which set of fragment
3065bd8deadSopenharmony_ci    texture coordinates are used to determine the texture value used in the
3075bd8deadSopenharmony_ci    texture function.  The same set of texture coordinates may be
3085bd8deadSopenharmony_ci    simultaneously used by multiple textures.
3095bd8deadSopenharmony_ci
3105bd8deadSopenharmony_ci        Specifying Enable with a <cap> parameter of TEXTURE_ENV1_EXT selects an
3115bd8deadSopenharmony_ci    alternate texture environment with a different set of texture functions.
3125bd8deadSopenharmony_ci    When TEXTURE_ENV1_EXT is enabled this environment supersedes texture
3135bd8deadSopenharmony_ci    environment zero.
3145bd8deadSopenharmony_ci
3155bd8deadSopenharmony_ci        Specifying TexEnv with a <target> parameter of TEXTURE_ENV1_EXT
3165bd8deadSopenharmony_ci    selects the TEXTURE_ENV1_EXT environment for modification.  The possible
3175bd8deadSopenharmony_ci    environment parameters for TEXTURE_ENV1_EXT are TEXTURE_ENV_MODE,
3185bd8deadSopenharmony_ci    TEXTURE_ENV_MODE_ALPHA_EXT, TEXTURE_ENV_SHIFT_EXT, and
3195bd8deadSopenharmony_ci    TEXTURE_ENV_COORD_SET_EXT.  TEXTURE_ENV_MODE may be set to one of
3205bd8deadSopenharmony_ci    ENV_COPY_EXT, ENV_REPLACE_EXT, ENV_MODULATE_EXT, ENV_ADD_EXT,
3215bd8deadSopenharmony_ci    ENV_SUBTRACT_EXT, ENV_REVERSE_SUBTRACT_EXT, ENV_BLEND_EXT, or
3225bd8deadSopenharmony_ci    ENV_REVERSE_BLEND_EXT.  TEXTURE_ENV_MODE_ALPHA_EXT may be set to one of
3235bd8deadSopenharmony_ci    ENV_COPY_EXT, ENV_REPLACE_EXT, ENV_MODULATE_EXT, ENV_ADD_EXT,
3245bd8deadSopenharmony_ci    ENV_SUBTRACT_EXT, or ENV_REVERSE_SUBTRACT_EXT.  TEXTURE_ENV_SHIFT_EXT is
3255bd8deadSopenharmony_ci    set to a four-value integer scale factor by providing four integers in the
3265bd8deadSopenharmony_ci    range [0,2].  TEXTURE_ENV_COORD_SET_EXT may be set to one of
3275bd8deadSopenharmony_ci    TEXTURE0_EXT .. TEXTURE<n>_EXT where <n> is the one less than the number
3285bd8deadSopenharmony_ci    of supported texture coordinate sets. If floating-point values are
3295bd8deadSopenharmony_ci    specified for either TEXTURE_ENV_SHIFT_EXT or TEXTURE_ENV_COORD_SET_EXT
3305bd8deadSopenharmony_ci    they are rounded to the nearest integer.
3315bd8deadSopenharmony_ci
3325bd8deadSopenharmony_ci        The value TEXTURE_ENV_MODE specifies a texture function for the R, G,
3335bd8deadSopenharmony_ci    and B components and the value of TEXTURE_ENV_MODE_ALPHA_EXT specifies a
3345bd8deadSopenharmony_ci    texture function for the A component.  The computed color components Rv,
3355bd8deadSopenharmony_ci    Gv, Bv, and Av are given by the equations:
3365bd8deadSopenharmony_ci
3375bd8deadSopenharmony_ci            Rv = Rx*(2^Rs),
3385bd8deadSopenharmony_ci            Gv = Gx*(2^Gs),
3395bd8deadSopenharmony_ci            Bv = Bx*(2^Bs) and
3405bd8deadSopenharmony_ci            Av = Ax*(2^As),
3415bd8deadSopenharmony_ci
3425bd8deadSopenharmony_ci    where the functions for Rx, Gx, Bx, and Ax are specified in Tables 3.12
3435bd8deadSopenharmony_ci    and 3.13,  and Rs, Gs, Bs, and As are the scaling factors specified with
3445bd8deadSopenharmony_ci    TEXTURE_ENV_SHIFT_EXT. The ENV_COPY_EXT, ENV_REPLACE_EXT,
3455bd8deadSopenharmony_ci    ENV_MODULATE_EXT, and ENV_ADD_EXT functions are specified in Table 3.12,
3465bd8deadSopenharmony_ci    and the ENV_SUBTRACT_EXT, ENV_REVERSE_SUBTRACT_EXT, ENV_BLEND_EXT, and
3475bd8deadSopenharmony_ci    ENV_REVERSE_BLEND_EXT functions are specified in Table 3.13.
3485bd8deadSopenharmony_ci
3495bd8deadSopenharmony_ci        The state required for texture environment TEXTURE_ENV0_EXT consists of
3505bd8deadSopenharmony_ci    the four-valued integer indicating the texture function, four floating-
3515bd8deadSopenharmony_ci    point TEXTURE_ENV_COLOR values and one MAX_TEXTURE_COORD_SETS_EXT-valued
3525bd8deadSopenharmony_ci    integer indicating the texture coordinate set binding.  The state required
3535bd8deadSopenharmony_ci    for texture environment TEXTURE_ENV1_EXT consists of the seven-valued
3545bd8deadSopenharmony_ci    integer indicating the texture function for the R,G, and B components, the
3555bd8deadSopenharmony_ci    five-valued integer indicating the texture function for the A component,
3565bd8deadSopenharmony_ci    four integer-valued TEXTURE_ENV_SHIFT_EXT values, one bit indicating
3575bd8deadSopenharmony_ci    whether TEXTURE_ENV1 is enabled, and one MAX_TEXTURE_COORD_SETS_EXT-valued
3585bd8deadSopenharmony_ci    integer indicating the texture coordinate set binding.  In the initial
3595bd8deadSopenharmony_ci    state, the texture functions for both environments is given by MODULATE,
3605bd8deadSopenharmony_ci    TEXTURE_ENV_COORD_SET_EXT is given by TEXTURE0_EXT in both environments, 
3615bd8deadSopenharmony_ci    TEXTURE_ENV_COLOR in environment zero is (0,0,0,0), TEXTURE_ENV_SHIFT_EXT
3625bd8deadSopenharmony_ci    in environment one is (0,0,0,0) and TEXTURE_ENV1_EXT is FALSE.
3635bd8deadSopenharmony_ci
3645bd8deadSopenharmony_ci    3.8.6 Texture Application
3655bd8deadSopenharmony_ci
3665bd8deadSopenharmony_ci    Texture is enabled or disabled using the generic Enable and Disable
3675bd8deadSopenharmony_ci    commands, respectively, with the symbolic constant TEXTURE_1D or TEXTURE_2D
3685bd8deadSopenharmony_ci    to enable the one-dimensional or two-dimensional texture, respectively.  
3695bd8deadSopenharmony_ci    If both one- and two-dimensional textures are enabled, the two dimensional
3705bd8deadSopenharmony_ci    texture is used. If all texturing is disabled and the currently bound
3715bd8deadSopenharmony_ci    texture environment is TEXTURE_ENV0_EXT, a rasterized fragment is
3725bd8deadSopenharmony_ci    passed on unaltered to the next stage of the GL (although its texture
3735bd8deadSopenharmony_ci    coordinates may be discarded).  If TEXTURE_ENV1_EXT is the current
3745bd8deadSopenharmony_ci    texture environment, the filtered texture values Rt, Gt, Bt, At, Lt, and
3755bd8deadSopenharmony_ci    It are replaced with 1.  Otherwise, a texture value is found according
3765bd8deadSopenharmony_ci    to the parameter values of the currently bound texture image of the
3775bd8deadSopenharmony_ci    appropriate dimensionality using the rules given in sections 3.8.1 and
3785bd8deadSopenharmony_ci    3.8.2.  This texture value is used along with the incoming fragment in
3795bd8deadSopenharmony_ci    computing the texture function indicated by the currently bound texture
3805bd8deadSopenharmony_ci    environment.  The result of this function replaces the incoming fragment's
3815bd8deadSopenharmony_ci    R, G, B, and A values.  These are the color values passed to subsequent
3825bd8deadSopenharmony_ci    operations.  Other data associated with the incoming fragment remain
3835bd8deadSopenharmony_ci    unchanged, except that the texture coordinates may be discarded.
3845bd8deadSopenharmony_ci        The required state us two bits indicating whether each of one- or
3855bd8deadSopenharmony_ci    two-dimensional texturing is enabled or disabled.  In the initial state,
3865bd8deadSopenharmony_ci    all texturing is disabled.
3875bd8deadSopenharmony_ci
3885bd8deadSopenharmony_ci
3895bd8deadSopenharmony_ciAdditions to Chapter 4 of the GL Specification (Per-Fragment Operations
3905bd8deadSopenharmony_ciand the Framebuffer)
3915bd8deadSopenharmony_ci
3925bd8deadSopenharmony_ci    None
3935bd8deadSopenharmony_ci
3945bd8deadSopenharmony_ciAdditions to Chapter 5 of the GL Specification (Special Functions)
3955bd8deadSopenharmony_ci
3965bd8deadSopenharmony_ci    None
3975bd8deadSopenharmony_ci
3985bd8deadSopenharmony_ciAdditions to Chapter 6 of the GL Specification (State and State Requests)
3995bd8deadSopenharmony_ci
4005bd8deadSopenharmony_ci    The value of the texture environment shift is queried by calling 
4015bd8deadSopenharmony_ci    GetTexEnviv, and GetTexEnvfv with the <target> parameter set of TEXTURE_ENV1
4025bd8deadSopenharmony_ci    and the <pname> parameter to TEXTURE_ENV_SHIFT_EXT.
4035bd8deadSopenharmony_ci
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ciAdditions to the GLX Specification
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    None
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ciGLX Protocol
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci    TBD
4125bd8deadSopenharmony_ci
4135bd8deadSopenharmony_ciDependencies on EXT_texture3D
4145bd8deadSopenharmony_ci
4155bd8deadSopenharmony_ci    If EXT_texture3D is not supported then the functionality and state
4165bd8deadSopenharmony_ci    associated with EXT_texture3D does not exist and is not supported.
4175bd8deadSopenharmony_ci    (this is more a note that section 3.8.6 should refer to texture3D too)
4185bd8deadSopenharmony_ci
4195bd8deadSopenharmony_ciDependencies on EXT_multitexture
4205bd8deadSopenharmony_ci
4215bd8deadSopenharmony_ci   If EXT_multitexture is not supported then the functionality and state
4225bd8deadSopenharmony_ci   associated with EXT_multitexture does not exist and the description of
4235bd8deadSopenharmony_ci   TEXTURE_ENV_COORD_SET_EXT is void.  If it is supported, then the state
4245bd8deadSopenharmony_ci   associated with texture environment TEXTURE_ENV1_EXT exists for each active
4255bd8deadSopenharmony_ci   texture.
4265bd8deadSopenharmony_ci
4275bd8deadSopenharmony_ciErrors
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    INVALID_VALUE is generated if <params> value for TEXTURE_ENV_SHIFT
4305bd8deadSopenharmony_ci    is not one of 0, 1, or 2.
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ci    INVALID_ENUM is generated if <target> parameter of TexEnvi or TexEnvf
4335bd8deadSopenharmony_ci    is TEXTURE_ENV1_EXT and <pname> parameter is not TEXTURE_ENV_MODE
4345bd8deadSopenharmony_ci    or TEXTURE_ENV_MODE_ALPHA_EXT.
4355bd8deadSopenharmony_ci
4365bd8deadSopenharmony_ci    INVALID_ENUM is generated if <target> parameter of TexEnvi, TexEnvf
4375bd8deadSopenharmony_ci    TexEnviv, TexEnvfv, GetTexEnviv, or GetTexEnvfv is TEXTURE_ENV1_EXT
4385bd8deadSopenharmony_ci    and <pname> parameter is not TEXTURE_ENV_MODE, TEXTURE_ENV_MODE_ALPHA_EXT,
4395bd8deadSopenharmony_ci    or TEXTURE_ENV_SHIFT_EXT.
4405bd8deadSopenharmony_ci
4415bd8deadSopenharmony_ci    INVALID_ENUM is generated if <target> parameter of TexEnvi, TexEnvf
4425bd8deadSopenharmony_ci    TexEnviv, or TexEnvfv is TEXTURE_ENV1_EXT, <pname> parameter is
4435bd8deadSopenharmony_ci    TEXTURE_ENV_MODE and <param> or <params> value is not one of ENV_COPY_EXT,
4445bd8deadSopenharmony_ci    ENV_REPLACE_EXT, ENV_MODULATE_EXT, ENV_ADD_EXT, ENV_SUBTRACT_EXT,
4455bd8deadSopenharmony_ci    ENV_REVERSE_SUBTRACT_EXT, ENV_BLEND_EXT, or ENV_REVERSE_BLEND_EXT
4465bd8deadSopenharmony_ci
4475bd8deadSopenharmony_ci    INVALID_ENUM is generated if <target> parameter of TexEnvi, TexEnvf
4485bd8deadSopenharmony_ci    TexEnviv, or TexEnvfv is TEXTURE_ENV1_EXT, <pname> parameter is
4495bd8deadSopenharmony_ci    TEXTURE_ENV_MODE_ALPHA_EXT and <param> or <params> value is not one of
4505bd8deadSopenharmony_ci    ENV_COPY_EXT, ENV_REPLACE_EXT, ENV_MODULATE_EXT, ENV_ADD_EXT,
4515bd8deadSopenharmony_ci    ENV_SUBTRACT_EXT, or ENV_REVERSE_SUBTRACT_EXT.
4525bd8deadSopenharmony_ci
4535bd8deadSopenharmony_ciNew State
4545bd8deadSopenharmony_ci
4555bd8deadSopenharmony_ci    Get Value               Get Command  Type   Initial Value   Attribute
4565bd8deadSopenharmony_ci    ---------               -----------  ----   -------------   ---------
4575bd8deadSopenharmony_ci    TEXTURE_ENV1_EXT        IsEnabled     B     FALSE           enable/texture
4585bd8deadSopenharmony_ci    TEXTURE_ENV_SHIFT_EXT   GetTexEnviv   Z4    (0, 0, 0, 0)    texture
4595bd8deadSopenharmony_ci    TEXTURE_ENV1,MODE       GetTexEnviv   Z7    MODULATE        texture
4605bd8deadSopenharmony_ci    TEXTURE_ENV1,MODE_ALPHA GetTexEnviv   Z5    MODULATE        texture
4615bd8deadSopenharmony_ci
4625bd8deadSopenharmony_ci
4635bd8deadSopenharmony_ciNew Implementation Dependent State
4645bd8deadSopenharmony_ci
4655bd8deadSopenharmony_ci    None
466