15bd8deadSopenharmony_ciXXX - Dead -- couldn't convince the ARB.  Use fragment_lighting &
25bd8deadSopenharmony_ciXXX   separate_specular_color instead.
35bd8deadSopenharmony_ciXXX - Not complete yet!!!
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ciName
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ci    SGIX_fragment_specular_lighting
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ciName Strings
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ci    GL_SGIX_fragment_specular_lighting
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ciVersion
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ci    $Date: 1998/07/06 19:51:38 $ $Revision: 1.2 $
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ciNumber
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ci    ??
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ciDependencies
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ci    OpenGL 1.1 is required.
245bd8deadSopenharmony_ci    SGIX_color_range affects the definition of this extension.
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ciOverview
275bd8deadSopenharmony_ci
285bd8deadSopenharmony_ci    This extension adds a new lighting stage to the OpenGL pipeline.  This
295bd8deadSopenharmony_ci    stage occurs during fragment processing after the texture environment
305bd8deadSopenharmony_ci    has been applied and before fog has been applied.  The extension
315bd8deadSopenharmony_ci    provides a mechanism for computing a post-texture specular lighting term.
325bd8deadSopenharmony_ci    This extension doesn't eliminate the specular term in vertex lighting, but
335bd8deadSopenharmony_ci    can be used to augment it.  This extension provides the state framework for a
345bd8deadSopenharmony_ci    more general lighting model, but only includes the equation for computing
355bd8deadSopenharmony_ci    the specular contribution.  The more general version is described in
365bd8deadSopenharmony_ci    SGIX_fragment_lighting.
375bd8deadSopenharmony_ci
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci
405bd8deadSopenharmony_ci                  Ct  Cf
415bd8deadSopenharmony_ci                  |   |-------------------------------+
425bd8deadSopenharmony_ci                  |   |                               |
435bd8deadSopenharmony_ci                ----------                            |
445bd8deadSopenharmony_ci                |        |                            |
455bd8deadSopenharmony_ci                | TexEnv |                            |
465bd8deadSopenharmony_ci                |        |                            |
475bd8deadSopenharmony_ci                ----------                            |
485bd8deadSopenharmony_ci                    |                                 |
495bd8deadSopenharmony_ci                ----------                            |
505bd8deadSopenharmony_ci                | Clamp  |            Nf  Lf  Hf  Ff  |
515bd8deadSopenharmony_ci                ----------            |   |   |   |   |
525bd8deadSopenharmony_ci                    |              -----------------  | FragmentColorMaterial
535bd8deadSopenharmony_ci                    |              |               |  v
545bd8deadSopenharmony_ci                    Cf'            | FragmentLight |--o-<- Material {Sm,...}
555bd8deadSopenharmony_ci                    |              |               |
565bd8deadSopenharmony_ci                    |              -----------------
575bd8deadSopenharmony_ci                    |                      |
585bd8deadSopenharmony_ci                    |                  ---------
595bd8deadSopenharmony_ci                    |                  | Clamp |
605bd8deadSopenharmony_ci                    |                  ---------
615bd8deadSopenharmony_ci                    |       Cl             |
625bd8deadSopenharmony_ci                    |      +----------------
635bd8deadSopenharmony_ci                    v      v
645bd8deadSopenharmony_ci                  ------------
655bd8deadSopenharmony_ci                  |          |
665bd8deadSopenharmony_ci                  |   SUM    |
675bd8deadSopenharmony_ci                  |          |
685bd8deadSopenharmony_ci                  ------------
695bd8deadSopenharmony_ci                       |
705bd8deadSopenharmony_ci                   ---------
715bd8deadSopenharmony_ci                   | Clamp |
725bd8deadSopenharmony_ci                   ---------
735bd8deadSopenharmony_ci                       |
745bd8deadSopenharmony_ci                       Cf''
755bd8deadSopenharmony_ci                       |
765bd8deadSopenharmony_ci                       v
775bd8deadSopenharmony_ci                    -------
785bd8deadSopenharmony_ci                    |     |
795bd8deadSopenharmony_ci                    | Fog |
805bd8deadSopenharmony_ci                    |     |
815bd8deadSopenharmony_ci                    -------
825bd8deadSopenharmony_ci                       |
835bd8deadSopenharmony_ci                       v
845bd8deadSopenharmony_ci
855bd8deadSopenharmony_ciIP Status
865bd8deadSopenharmony_ci
875bd8deadSopenharmony_ci    Silicon Graphics has filed for patent protection for some of the
885bd8deadSopenharmony_ci    techniques described in this extension document.
895bd8deadSopenharmony_ci
905bd8deadSopenharmony_ciIssues
915bd8deadSopenharmony_ci
925bd8deadSopenharmony_ci    *   does this spec enable a reasonable evolution from a post-texture
935bd8deadSopenharmony_ci        specular highlight to a full blown per-pixel lighting computation?
945bd8deadSopenharmony_ci
955bd8deadSopenharmony_ci    *   can we eliminate some commands and state now and allow the generality
965bd8deadSopenharmony_ci        to show up later?  It doesn't seem like there is much harm in maintaining
975bd8deadSopenharmony_ci        extra state for computations that isn't actually used since it can be
985bd8deadSopenharmony_ci        maintained on the host.  We eliminate the Lighting environment term
995bd8deadSopenharmony_ci        since it provides extra capability for how the lighting term is combined.
1005bd8deadSopenharmony_ci        It can show up with the fragment_lighting extension.
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ci    *   given the relaxation in the requirements for how the specular term is
1035bd8deadSopenharmony_ci        computed, it is possible to support multiple specular lights but much
1045bd8deadSopenharmony_ci        less likely to be able to support the same number of full blown fragment
1055bd8deadSopenharmony_ci        lights.
1065bd8deadSopenharmony_ci
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ciNew Procedures and Functions
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    void FragmentLightModeliSGIX(enum pname, int param);
1115bd8deadSopenharmony_ci    void FragmentLightModelfSGIX(enum pname, float param);
1125bd8deadSopenharmony_ci    void FragmentLightModelivSGIX(enum pname, int *params);
1135bd8deadSopenharmony_ci    void FragmentLightModelfvSGIX(enum pname, float *params);
1145bd8deadSopenharmony_ci
1155bd8deadSopenharmony_ci    void FragmentLightiSGIX(enum light, enum pname, int param);
1165bd8deadSopenharmony_ci    void FragmentLightfSGIX(enum light, enum pname, float param);
1175bd8deadSopenharmony_ci    void FragmentLightivSGIX(enum light, enum pname, int *params);
1185bd8deadSopenharmony_ci    void FragmentLightfvSGIX(enum light, enum pname, float *params);
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    void GetFragmentLightivSGIX(enum light, enum value, int *data);
1215bd8deadSopenharmony_ci    void GetFragmentLightfvSGIX(enum light, enum value, float *data);
1225bd8deadSopenharmony_ci
1235bd8deadSopenharmony_ci    void FragmentMaterialfSGIX(enum face, enum pname, const float param);
1245bd8deadSopenharmony_ci    void FragmentMaterialiSGIX(enum face, enum pname, const int param);
1255bd8deadSopenharmony_ci    void FragmentMaterialfvSGIX(enum face, enum pname, const float *params);
1265bd8deadSopenharmony_ci    void FragmentMaterialivSGIX(enum face, enum pname, const int *params);
1275bd8deadSopenharmony_ci
1285bd8deadSopenharmony_ci    void FragmentColorMaterialSGIX(enum face, enum mode);
1295bd8deadSopenharmony_ci
1305bd8deadSopenharmony_ci    void GetFragmentMaterialfvSGIX(enum face, enum pname, float *data);
1315bd8deadSopenharmony_ci    void GetFragmentMaterialivSGIX(enum face, enum pname, int *data);
1325bd8deadSopenharmony_ci
1335bd8deadSopenharmony_ciNew Tokens
1345bd8deadSopenharmony_ci
1355bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
1365bd8deadSopenharmony_ci    the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
1375bd8deadSopenharmony_ci    GetDoublev:
1385bd8deadSopenharmony_ci
1395bd8deadSopenharmony_ci    FRAGMENT_LIGHTING_SGIX                              XXXX
1405bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL_SGIX                        XXXX
1415bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL_FACE_SGIX                   XXXX
1425bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX              XXXX
1435bd8deadSopenharmony_ci
1445bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
1455bd8deadSopenharmony_ci    and GetDoublev:
1465bd8deadSopenharmony_ci
1475bd8deadSopenharmony_ci    MAX_FRAGMENT_LIGHTS_SGIX                            XXXX
1485bd8deadSopenharmony_ci    MAX_ACTIVE_LIGHTS_SGIX                              XXXX
1495bd8deadSopenharmony_ci    CURRENT_RASTER_NORMAL_SGIX                          XXXX
1505bd8deadSopenharmony_ci
1515bd8deadSopenharmony_ci    Accepted by the <light> parameter of FragmentLightfSGIX,
1525bd8deadSopenharmony_ci    FragmentLightiSGIX, FragmentLightfvSGIX, and FragmentLightivSGIX, and by
1535bd8deadSopenharmony_ci    the <cap> parameter of Enable, Disable, and IsEnabled, and by the <light>
1545bd8deadSopenharmony_ci    parameter of GetFragmentLightfvSGIX and GetFragmentLightivSGIX:
1555bd8deadSopenharmony_ci
1565bd8deadSopenharmony_ci    FRAGMENT_LIGHT0_SGIX                                XXXX
1575bd8deadSopenharmony_ci    .
1585bd8deadSopenharmony_ci    .
1595bd8deadSopenharmony_ci    .
1605bd8deadSopenharmony_ci    FRAGMENT_LIGHT7_SGIX                                XXXX
1615bd8deadSopenharmony_ci
1625bd8deadSopenharmony_ci    Accepted by the <pname> parameter of FragmentLightModeliSGIX,
1635bd8deadSopenharmony_ci    FragmentLightModelfSGIX, FragmentLightModelivSGIX,
1645bd8deadSopenharmony_ci    FragmentLightModelfvSGIX, GetBooleanv, GetIntegerv, GetFloatv, and
1655bd8deadSopenharmony_ci    GetDoublev:
1665bd8deadSopenharmony_ci
1675bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX              XXXX
1685bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX                  XXXX
1695bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX                   XXXX
1705bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX      XXXX
1715bd8deadSopenharmony_ci
1725bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.1 Specification (OpenGL Operation)
1735bd8deadSopenharmony_ci
1745bd8deadSopenharmony_ci    Section 2.12 Current Raster Position
1755bd8deadSopenharmony_ci
1765bd8deadSopenharmony_ci    ... <paragraph 2>
1775bd8deadSopenharmony_ci    The current raster position consists of three window coordinates xw, yw,
1785bd8deadSopenharmony_ci    and zw, a clip corrdinate wc value, an eye coordinate distance, a valid
1795bd8deadSopenharmony_ci    bit, and associated data consisting of a color, normal, and texture
1805bd8deadSopenharmony_ci    coordinates. It is set ...
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    ... <paragraph 5>
1835bd8deadSopenharmony_ci    The current raster position requires five single-precision floating point
1845bd8deadSopenharmony_ci    values for its xw, yw, and zw window coordinates, its wc clip coordinate,
1855bd8deadSopenharmony_ci    and its eye coordinate distance, a single valid bit, a color (RGBA and color
1865bd8deadSopenharmony_ci    index), normal, and texture coordinates for associated data.  In the initial
1875bd8deadSopenharmony_ci    state, the coordinates and texture coordinates are both (0,0,0,1), the eye
1885bd8deadSopenharmony_ci    coordinate distance is 0, the valid bit is set, the associated RGBA color is
1895bd8deadSopenharmony_ci    (1,1,1,1), the associated color index is 1, and the associated normal is
1905bd8deadSopenharmony_ci    (0,0,1).  In RGBA mode, the associated color index always has its initial
1915bd8deadSopenharmony_ci    value; in color index mode, the RGBA color always maintains its initial
1925bd8deadSopenharmony_ci    value.
1935bd8deadSopenharmony_ci
1945bd8deadSopenharmony_ci    Section 2.13 Colors and Coloring
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    ...
1975bd8deadSopenharmony_ci    Next vertex lighting, if enabled produces a color.  If vertex lighting is
1985bd8deadSopenharmony_ci    disabled, the current color is used in further processing. After vertex
1995bd8deadSopenharmony_ci    lighting, RGBA colors are clamped to the range [0,1]. A color index is
2005bd8deadSopenharmony_ci    converted to fixed-point and then its integer portion is masked (see
2015bd8deadSopenharmony_ci    section 2.13.16). After clamping or masking, a primitive may be flatshaded,
2025bd8deadSopenharmony_ci    indicating that all vertices of the primitive are to have the same color
2035bd8deadSopenharmony_ci    (and normal).  Finally, a primitive is clipped, then colors (texture
2045bd8deadSopenharmony_ci    coordinates and normals) must be computed at the vertices introduced or
2055bd8deadSopenharmony_ci    modified by clipping.
2065bd8deadSopenharmony_ci
2075bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.1 Specification (Rasterization)
2085bd8deadSopenharmony_ci
2095bd8deadSopenharmony_ci    Section 3.6.3 Rasterization of Pixel Rectangles
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    Conversion to Fragments
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci    ... <paragraph 2>
2145bd8deadSopenharmony_ci    A fragment arising from a group consisting of color data takes on the color
2155bd8deadSopenharmony_ci    index or color components of the group; the depth, normal and texture
2165bd8deadSopenharmony_ci    coordinates are taken from the current raster position's associated data.
2175bd8deadSopenharmony_ci    A fragment arising from a depth component takes the component's depth
2185bd8deadSopenharmony_ci    value; the color, normal, and texture coordinate are given by those associated
2195bd8deadSopenharmony_ci    with the current raster position.  In both cases texture coordinates s, t,
2205bd8deadSopenharmony_ci    and r are preplaced with s/q, t/q, and r/q, respectively.  If q is less than
2215bd8deadSopenharmony_ci    or equal to zero the results are undefined.  Groups arising from DrawPixels
2225bd8deadSopenharmony_ci    with a <format> of STENCIL_INDEX are treated specially and are described in
2235bd8deadSopenharmony_ci    section 4.3.1.
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ci    Before Section 3.9 Fog insert:
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    Section 3.9 Fragment Lighting
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ci    If enabled, fragment lighting computes a color for each rasterized fragment
2315bd8deadSopenharmony_ci    by applying an equation defined by a client-specified lighting model to
2325bd8deadSopenharmony_ci    a collection of parameters that can include the fragment coordinates, the
2335bd8deadSopenharmony_ci    coordinates of one or more light sources, the fragment normal, and
2345bd8deadSopenharmony_ci    parameters defining the characteristics of the light source and current
2355bd8deadSopenharmony_ci    fragment material.  Fragment lighting is only defined for RGBA mode, it
2365bd8deadSopenharmony_ci    has no effect in color index mode.
2375bd8deadSopenharmony_ci
2385bd8deadSopenharmony_ci    Fragment lighting may be in one of two states:
2395bd8deadSopenharmony_ci
2405bd8deadSopenharmony_ci    1. Lighting Off.  In this state the color assigned to a fragment is the
2415bd8deadSopenharmony_ci       rasterized fragment's post-texturing color.
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    2. Lighting On.  In this state the color assigned to a fragment is the
2445bd8deadSopenharmony_ci       result of summing the rasterized fragment's post-texturing color and
2455bd8deadSopenharmony_ci       a color computed from the current fragment lighting parameters.
2465bd8deadSopenharmony_ci
2475bd8deadSopenharmony_ci    Fragment lighting is turned either on or off using the generic Enable or
2485bd8deadSopenharmony_ci    Disable commands with the symbolic value FRAGMENT_LIGHTING_SGIX.
2495bd8deadSopenharmony_ci
2505bd8deadSopenharmony_ci    3.9.2 Lighting Operation
2515bd8deadSopenharmony_ci
2525bd8deadSopenharmony_ci    The desired general equation for the fragment illumination model is:
2535bd8deadSopenharmony_ci
2545bd8deadSopenharmony_ci    Cl =  Em                    emissive
2555bd8deadSopenharmony_ci       + Am*As                  ambient material*scene ambient color
2565bd8deadSopenharmony_ci       SUM{_i = 0 through Nf-1} {
2575bd8deadSopenharmony_ci       + Atten_i*SpotL_i*{      distance/spot light attenuation
2585bd8deadSopenharmony_ci            + Am*Al_i           ambient material*ambient light
2595bd8deadSopenharmony_ci            + Dm*Dl_i*(N.L_i)   diffuse material*diffuse light
2605bd8deadSopenharmony_ci            + Sm*Sl_i*(N.H_i)^n specular material*specular light
2615bd8deadSopenharmony_ci          }
2625bd8deadSopenharmony_ci        }
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci        Nf is the number of fragment light sources
2655bd8deadSopenharmony_ci        N is the fragment normal vector
2665bd8deadSopenharmony_ci        L_i is the direction vector from the fragment position to the light source
2675bd8deadSopenharmony_ci        H_i is the half angle vector
2685bd8deadSopenharmony_ci        n is the specular exponent (shininess)
2695bd8deadSopenharmony_ci
2705bd8deadSopenharmony_ci    Subset the equation to the specular term:
2715bd8deadSopenharmony_ci
2725bd8deadSopenharmony_ci    I[i] = Sm*Sl*(N.H_i)^n)
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    and
2755bd8deadSopenharmony_ci
2765bd8deadSopenharmony_ci    I' = SUM{i = 0 through Nf-1} I[i]   (3.1)
2775bd8deadSopenharmony_ci
2785bd8deadSopenharmony_ci
2795bd8deadSopenharmony_ci    Equation (3.1) is essentially the same as the specular term of the vertex
2805bd8deadSopenharmony_ci    lighting equation described in section 2.13.1 for a single light source.
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    In order to compute the illumination terms for each fragment, the eye
2835bd8deadSopenharmony_ci    coordinates of the fragment can be used to compute the light direction,
2845bd8deadSopenharmony_ci    half angle vector, and attenuation factor in a manner similar to that used
2855bd8deadSopenharmony_ci    in the vertex lighting computations.  It is permissible for an
2865bd8deadSopenharmony_ci    implementation to approximate these by computing these values as well as
2875bd8deadSopenharmony_ci    the normal vector at the vertices and interpolating and renormalizing the
2885bd8deadSopenharmony_ci    results, or by computing the entire equation at the vertices and
2895bd8deadSopenharmony_ci    interpolating the color.
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ci    Fragment material state is maintained which is distinct from the
2925bd8deadSopenharmony_ci    vertex material state.  The fragment material state consists of
2935bd8deadSopenharmony_ci    emission, ambient, diffuse, specular and shininess terms for both
2945bd8deadSopenharmony_ci    the front and back face of a primitive though only the specular and
2955bd8deadSopenharmony_ci    shininess terms are used by this extension.  Unlike vertex lighting, the
2965bd8deadSopenharmony_ci    fragment material state is constant across a primitive since
2975bd8deadSopenharmony_ci    it is resolved during rasterization.  The results of the back face
2985bd8deadSopenharmony_ci    computation described in section 3.5.1 are used to determine whether
2995bd8deadSopenharmony_ci    the front material or back material is used when two sided lighting
3005bd8deadSopenharmony_ci    is enabled.
3015bd8deadSopenharmony_ci
3025bd8deadSopenharmony_ci    There is separate state for each fragment light source.  The
3035bd8deadSopenharmony_ci    fragment light source parameters are the same as the vertex light
3045bd8deadSopenharmony_ci    source parameters described in section 2.13.1.  The minimum number of
3055bd8deadSopenharmony_ci    fragment light sources is 1.  The number of available fragment light
3065bd8deadSopenharmony_ci    sources can be queried by issuing the Get command with the <pname>
3075bd8deadSopenharmony_ci    parameter set to MAX_FRAGMENT_LIGHTS_SGIX.
3085bd8deadSopenharmony_ci
3095bd8deadSopenharmony_ci    Distinct lighting model state is also maintained for vertex lighting and
3105bd8deadSopenharmony_ci    fragment lighting.  The lighting model state is described in section
3115bd8deadSopenharmony_ci    2.13.1.  Fragment lighting model state includes one additional parameter,
3125bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX, which controls how normals
3135bd8deadSopenharmony_ci    are selected for use in the fragment lighting computations for a primitive.
3145bd8deadSopenharmony_ci    If FLAT is selected for the lighting model, the normal from the provoking
3155bd8deadSopenharmony_ci    vertex (as described in Section 2.13.7 Flatshading) of the primitive for all
3165bd8deadSopenharmony_ci    fragment lighting computations for the primitive.  If SMOOTH is specified
3175bd8deadSopenharmony_ci    a normal is computed for each fragment using the normals from all of the
3185bd8deadSopenharmony_ci    vertices of the primitive.
3195bd8deadSopenharmony_ci
3205bd8deadSopenharmony_ci    Fragment lighting differs from vertex lighting in that all components
3215bd8deadSopenharmony_ci    of lighting parameters which are of type color in Table 2.7 are clamped
3225bd8deadSopenharmony_ci    to the range [0,1] when they are specified.
3235bd8deadSopenharmony_ci
3245bd8deadSopenharmony_ci    Equation 3.2 is evaluated for each light source and the resulting
3255bd8deadSopenharmony_ci    colors are summed.  The resulting color components are clamped to the
3265bd8deadSopenharmony_ci    range [0,1] and then passed to the lighting environment computation.
3275bd8deadSopenharmony_ci
3285bd8deadSopenharmony_ci
3295bd8deadSopenharmony_ci    3.9.3 Lighting Parameter Specification
3305bd8deadSopenharmony_ci
3315bd8deadSopenharmony_ci    GetFragmentMaterialfvSGIX and GetFragmentMaterialivSGIX.
3325bd8deadSopenharmony_ci    The fragment material state can be set with the commands
3335bd8deadSopenharmony_ci    FragmentMaterialfSGIX, FragmentMaterialfvSGIX, FragmentMaterialiSGIX,
3345bd8deadSopenharmony_ci    FragmentMaterialivSGIX using the values AMBIENT, DIFFUSE, SPECULAR,
3355bd8deadSopenharmony_ci    SHININESS and EMISSION.  This state can be queried using the commands
3365bd8deadSopenharmony_ci    GetFragmentMaterialfvSGIX and GetFragmentMaterialivSGIX.
3375bd8deadSopenharmony_ci
3385bd8deadSopenharmony_ci    Lighting parameters for fragment light i can be modified by issuing the
3395bd8deadSopenharmony_ci    commands FragmentLightfSGIX, FragmentLightiSGIX, FragmentLightfvSGIX, and
3405bd8deadSopenharmony_ci    FragmentLightivSGIX with the <light> parameter
3415bd8deadSopenharmony_ci    set to FRAGMENT_LIGHTi_SGIX.  The lighting parameters for fragment light i
3425bd8deadSopenharmony_ci    can be queried by issuing the commands GetFragmentLightfvSGIX and
3435bd8deadSopenharmony_ci    GetFragmentLightivSGIX with the <light> parameter set to FRAGMENT_LIGHTi_SGIX.
3445bd8deadSopenharmony_ci
3455bd8deadSopenharmony_ci    Lighting model parameters for fragment lighting can be modified using the
3465bd8deadSopenharmony_ci    commands FragmentLightModel{T}SGIX, FragmentLightModel{T}vSGIX.  The
3475bd8deadSopenharmony_ci    lighting model parameters can be queried by issuing the Get command <pname>
3485bd8deadSopenharmony_ci    parameter set to the appropriate fragment lighting model parameter:
3495bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX, FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX,
3505bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX or FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX.
3515bd8deadSopenharmony_ci
3525bd8deadSopenharmony_ci
3535bd8deadSopenharmony_ci    3.9.4 FragmentColorMaterial
3545bd8deadSopenharmony_ci
3555bd8deadSopenharmony_ci    It is possible to replace one or more fragment material properties terms in
3565bd8deadSopenharmony_ci    Equation 3.1 with the fragment's pre-texturing color, causing these color
3575bd8deadSopenharmony_ci    values to be used during the lighting computation.  This behavior is enabled
3585bd8deadSopenharmony_ci    and disabled  by calling Enable and Disable with the symbolic value
3595bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL.
3605bd8deadSopenharmony_ci
3615bd8deadSopenharmony_ci    The command that controls which of these modes is selected is
3625bd8deadSopenharmony_ci
3635bd8deadSopenharmony_ci        void FragmentColorMaterial(enum face, enum mode);
3645bd8deadSopenharmony_ci
3655bd8deadSopenharmony_ci    <face> is one of FRONT, BACK, or FRONT_AND_BACK, indicating whether
3665bd8deadSopenharmony_ci    the front material, back material, or both are affected by the
3675bd8deadSopenharmony_ci    pre-texturing color.  <mode> is one of EMISSION, AMBIENT, DIFFUSE,
3685bd8deadSopenharmony_ci    SPECULAR, or AMBIENT_AND_DIFFUSE and specifies which material property
3695bd8deadSopenharmony_ci    or properties are subsituted with the pre-texturing color.  The substutions
3705bd8deadSopenharmony_ci    do not affect the material state.  When FragmentColorMaterial
3715bd8deadSopenharmony_ci    is disabled the values in the fragment material state are used.
3725bd8deadSopenharmony_ci    GetFragmentMaterial returns the fragment material last specified with
3735bd8deadSopenharmony_ci    FragmentMaterial, regardless of whether FragmentColorMaterial is enabled.
3745bd8deadSopenharmony_ci    Although all of the fragment material parameters may be substituted, only
3755bd8deadSopenharmony_ci    substituting the SPECULAR material property will affect the result of
3765bd8deadSopenharmony_ci    the lighting computation.
3775bd8deadSopenharmony_ci
3785bd8deadSopenharmony_ci    3.9.5 Interactions with Vertex Lighting
3795bd8deadSopenharmony_ci
3805bd8deadSopenharmony_ci    In order to allow implementions to share resources for vertex lighting and
3815bd8deadSopenharmony_ci    fragment lighting, an implementation may limit the maximum number of combined
3825bd8deadSopenharmony_ci    vertex and fragment lights to a number less than the sum of MAX_LIGHTS and
3835bd8deadSopenharmony_ci    MAX_FRAGMENT_LIGHTS_SGIX.  This limit can be queried using the Get command
3845bd8deadSopenharmony_ci    with <pname> parameter MAX_ACTIVE_LIGHTS_SGIX.  State for all
3855bd8deadSopenharmony_ci    fragment and vertex lights is always maintained.  When multiple
3865bd8deadSopenharmony_ci    lights are enabled, priority is given to vertex lights starting with
3875bd8deadSopenharmony_ci    LIGHT0 through LIGHT<n> where <n> is equal to MAX_LIGHTS, followed by
3885bd8deadSopenharmony_ci    FRAGMENT_LIGHT0_SGIX through FRAGMENT_LIGHT<m>_SGIX where <m> is equal
3895bd8deadSopenharmony_ci    to MAX_FRAGMENT_LIGHTS_SGIX.
3905bd8deadSopenharmony_ci
3915bd8deadSopenharmony_ci
3925bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations
3935bd8deadSopenharmony_ciand the Frame Buffer)
3945bd8deadSopenharmony_ci
3955bd8deadSopenharmony_ci    None
3965bd8deadSopenharmony_ci
3975bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.1 Specification (Special Functions)
3985bd8deadSopenharmony_ci
3995bd8deadSopenharmony_ci    None
4005bd8deadSopenharmony_ci
4015bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.1 Specification (State and State Requests)
4025bd8deadSopenharmony_ci
4035bd8deadSopenharmony_ci    TBD
4045bd8deadSopenharmony_ci
4055bd8deadSopenharmony_ciAdditions to the GLX Specification
4065bd8deadSopenharmony_ci
4075bd8deadSopenharmony_ci    TBD
4085bd8deadSopenharmony_ci
4095bd8deadSopenharmony_ciDependencies on SGIX_color_range
4105bd8deadSopenharmony_ci
4115bd8deadSopenharmony_ci    If SGIX_color_range is implemented, then the components of lighting
4125bd8deadSopenharmony_ci    parameters of type color, the result of evaluating the lighting
4135bd8deadSopenharmony_ci    equation and the results of evaluating the lighting environment
4145bd8deadSopenharmony_ci    are clamped to the extended color range rather than [0,1].
4155bd8deadSopenharmony_ci
4165bd8deadSopenharmony_ci
4175bd8deadSopenharmony_ciErrors
4185bd8deadSopenharmony_ci    INVALID_ENUM is generated if FragmentMaterial{T}SGIX,
4195bd8deadSopenharmony_ci    FragmentMaterial{T}vSGIX, or FragmentColorMaterialSGIX, parameter <face> is
4205bd8deadSopenharmony_ci    not FRONT, BACK or FRONT_AND_BACK.
4215bd8deadSopenharmony_ci
4225bd8deadSopenharmony_ci    INVALID_ENUM is generated if FragmentMaterial{T}SGIX or
4235bd8deadSopenharmony_ci    FragmentMaterial{T}vSGIX parameter <pname> is not AMBIENT, DIFFUSE,
4245bd8deadSopenharmony_ci    SPECULAR, EMISSION, SHININESS, or AMBIENT_AND_DIFFUSE.
4255bd8deadSopenharmony_ci
4265bd8deadSopenharmony_ci    INVALID_ENUM is generated if GetFragmentMaterial{T}vSGIX parameter <face>
4275bd8deadSopenharmony_ci    is not FRONT or BACK.
4285bd8deadSopenharmony_ci
4295bd8deadSopenharmony_ci    INVALID_ENUM is generated if GetFragmentMaterial{T}vSGIX parameter <pname>
4305bd8deadSopenharmony_ci    is not AMBIENT, DIFFUSE, SPECULAR, EMISSION, or SHININESS,
4315bd8deadSopenharmony_ci
4325bd8deadSopenharmony_ci    INVALID_ENUM if FragmentColorMaterialSGIX parameter <mode> is not EMISSION,
4335bd8deadSopenharmony_ci    AMBIENT, DIFFUSE, SPECULAR, or AMBIENT_AND_DIFFUSE
4345bd8deadSopenharmony_ci
4355bd8deadSopenharmony_ci    INVALID_ENUM if LightEnviSGIX parameter <pname> is not LIGHT_ENV_MODE_SGIX
4365bd8deadSopenharmony_ci    or if parameter <mode> is not REPLACE, MODULATE, or ADD.
4375bd8deadSopenharmony_ci
4385bd8deadSopenharmony_ci    INVALID_ENUM is generated if FragmentLightModel{T}SGIX <pname> is not
4395bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX, FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX
4405bd8deadSopenharmony_ci    or FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX or if
4415bd8deadSopenharmony_ci    FragmentLightModel{T}vSGIX, parameter <pname> is not
4425bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX, FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX
4435bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX or
4445bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX.
4455bd8deadSopenharmony_ci
4465bd8deadSopenharmony_ci    INVALID_ENUM is generated if FragmentLight{T}SGIX, FragmentLight{T}vSGIX,
4475bd8deadSopenharmony_ci    or GetFragmentLight{T}vSGIX parameter <light> is not FRAGMENT_LIGHT0_SGIX
4485bd8deadSopenharmony_ci    ... FRAGMENT_LIGHT<n>_SGIX where n is one minus the number of supported
4495bd8deadSopenharmony_ci    fragment lights, or if FragmentLight{T}SGIX parameter <pname> is not
4505bd8deadSopenharmony_ci    SPOT_EXPONENT, SPOT_CUTOFF, CONSTANT_ATTENUATION, LINEAR_ATTENUATION, or
4515bd8deadSopenharmony_ci    QUADRATIC_ATTENUATION, or if FragmentLight{T}vSGIX or
4525bd8deadSopenharmony_ci    GetFragmentLight{T}vSGIX parameter <pname> is not AMBIENT, DIFFUSE,
4535bd8deadSopenharmony_ci    SPECULAR, POSITION, SPOT_DIRECTION, SPOT_EXPONENT, SPOT_CUTOFF,
4545bd8deadSopenharmony_ci    CONSTANT_ATTENUATION, LINEAR_ATTENUATION, or QUADRATIC_ATTENUATION.
4555bd8deadSopenharmony_ci
4565bd8deadSopenharmony_ci    INVALID_VALUE is generated if FragmentLight{T}SGIX or FragmentLight{T}vSGIX
4575bd8deadSopenharmony_ci    parameter <param> if a spot exponent value is specified outside the range
4585bd8deadSopenharmony_ci    [0,128], or if spot cutoff is specified outside the range [0,90] (except
4595bd8deadSopenharmony_ci    for the special value 180), or if a negative attenuation factor is
4605bd8deadSopenharmony_ci    specified.
4615bd8deadSopenharmony_ci
4625bd8deadSopenharmony_ci    INVALID_OPERATION is generated if FragmentMaterial{T}SGIX,
4635bd8deadSopenharmony_ci    FragmentMaterial{T}vSGIX, FragmentColorMaterialSGIX,
4645bd8deadSopenharmony_ci    GetFragmentMaterial{T}vSGIX, LightEnviSGIX, FragmentLight{T}SGIX,
4655bd8deadSopenharmony_ci    FragmentLight{T}vSGIX, FragmentLightModel{T}SGIX,
4665bd8deadSopenharmony_ci    FragmentLightModel{T}vSGIX or GetFragmentLight{T}vSGIX is executed between
4675bd8deadSopenharmony_ci    execution of Begin and the corresponding execution of End.
4685bd8deadSopenharmony_ci
4695bd8deadSopenharmony_ciNew State
4705bd8deadSopenharmony_ci
4715bd8deadSopenharmony_ci    Get Value                                   Get Command                     Type    Initial Value           Attribute
4725bd8deadSopenharmony_ci    ---------                                   -----------                     ----    -------------           ---------
4735bd8deadSopenharmony_ci
4745bd8deadSopenharmony_ci    FRAGMENT_LIGHTING_SGIX                      IsEnabled                       B       False                   lighting/enable
4755bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL_SGIX                IsEnabled                       B       False                   lighting/enable
4765bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL_PARAMETER_SGIX      GetIntegerv                     Z5      AMBIENT_AND_DIFFUSE     lighting
4775bd8deadSopenharmony_ci    FRAGMENT_COLOR_MATERIAL_FACE_SGIX           GetIntegerv                     Z3      FRONT_AND_BACK          lighting
4785bd8deadSopenharmony_ci    AMBIENT                                     GetFragmentMaterialfvSGIX       2xC     (0.2,0.2,0.2,1.0)       lighting
4795bd8deadSopenharmony_ci    DIFFUSE                                     GetFragmentMaterialfvSGIX       2xC     (0.8,0.8,0.8,1.0)       lighting
4805bd8deadSopenharmony_ci    SPECULAR                                    GetFragmentMaterialfvSGIX       2xC     (0.0,0.0,0.0,1.0)       lighting
4815bd8deadSopenharmony_ci    EMISSION                                    GetFragmentMaterialfvSGIX       2xC     (0.0,0.0,0.0,1.0)       lighting
4825bd8deadSopenharmony_ci    SHININESS                                   GetFragmentMaterialfvSGIX       2xR     0.0                     lighting
4835bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_AMBIENT_SGIX           GetFloatv                       C       (0.2,0.2,0.2,0.2)       lighting
4845bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_LOCAL_VIEWER_SGIX      GetBooleanv                     B       False                   lighting
4855bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_TWO_SIDE_SGIX          GetBooleanv                     B       False                   lighting
4865bd8deadSopenharmony_ci    FRAGMENT_LIGHT_MODEL_NORMAL_INTERPOLATION_SGIX      GetIntegerv             Z2      SMOOTH                  lighting
4875bd8deadSopenharmony_ci    AMBIENT                                     GetFragmentLightfvSGIX          1*xC    (0.0,0.0,0.0,1.0)       lighting
4885bd8deadSopenharmony_ci    DIFFUSE                                     GetFragmentLightfvSGIX          1*xC    see 3.x                 lighting
4895bd8deadSopenharmony_ci    SPECULAR                                    GetFragmentLightfvSGIX          1*xC    see 3.x                 lighting
4905bd8deadSopenharmony_ci    POSITION                                    GetFragmentLightfvSGIX          1*xP    (0.0,0.0,1.0,0.0)       lighting
4915bd8deadSopenharmony_ci    CONSTANT_ATTENUATION                        GetFragmentLightfvSGIX          1*xR    1.0                     lighting
4925bd8deadSopenharmony_ci    LINEAR_ATTENUATION                          GetFragmentLightfvSGIX          1*xR+   0.0                     lighting
4935bd8deadSopenharmony_ci    QUADRATIC_ATTENUATION                       GetFragmentLightfvSGIX          1*xR+   0.0                     lighting
4945bd8deadSopenharmony_ci    SPOT_DIRECTION                              GetFragmentLightfvSGIX          1*xD    (0.0,0.0,-1.0)          lighting
4955bd8deadSopenharmony_ci    SPOT_EXPONENT                               GetFragmentLightfvSGIX          1*xR+   0.0                     lighting
4965bd8deadSopenharmony_ci    SPOT_CUTOFF                                 GetFragmentLightfvSGIX          1*xR+   180.0                   lighting
4975bd8deadSopenharmony_ci    FRAGMENT_LIGHTi_SGIX                        IsEnabled                       1*xB    False                   lighting/enable
4985bd8deadSopenharmony_ci    LIGHT_ENV_MODE_SGIX                         GetIntegerv                     Z3      REPLACE                 lighting
4995bd8deadSopenharmony_ci
5005bd8deadSopenharmony_ci    CURRENT_RASTER_NORMAL_SGIX                  GetFloatv                       N       (0,0,1)                 current
5015bd8deadSopenharmony_ci
5025bd8deadSopenharmony_ciNew Implementation Dependent State
5035bd8deadSopenharmony_ci
5045bd8deadSopenharmony_ci    Get Value                           Get Command                     Type    Minimum Value
5055bd8deadSopenharmony_ci    ---------                           -----------                     ----    -------------
5065bd8deadSopenharmony_ci    MAX_FRAGMENT_LIGHTS_SGIX            GetIntegerv                     Z+      1
5075bd8deadSopenharmony_ci    MAX_ACTIVE_LIGHTS_SGIX              GetIntegerv                     z+      MAX_LIGHTS
508