15bd8deadSopenharmony_ciXXX - Not complete yet!!!
25bd8deadSopenharmony_ci
35bd8deadSopenharmony_ciName
45bd8deadSopenharmony_ci
55bd8deadSopenharmony_ci    SGIX_nonlinear_lighting_pervertex
65bd8deadSopenharmony_ci
75bd8deadSopenharmony_ciName Strings
85bd8deadSopenharmony_ci
95bd8deadSopenharmony_ci    GL_SGIX_nonlinear_lighting_pervertex
105bd8deadSopenharmony_ci
115bd8deadSopenharmony_ciVersion
125bd8deadSopenharmony_ci
135bd8deadSopenharmony_ci    $Date: 1997/09/23 23:20:38 $ $Revision: 1.1 $
145bd8deadSopenharmony_ci
155bd8deadSopenharmony_ciNumber
165bd8deadSopenharmony_ci
175bd8deadSopenharmony_ci    ???
185bd8deadSopenharmony_ci
195bd8deadSopenharmony_ciDependencies
205bd8deadSopenharmony_ci
215bd8deadSopenharmony_ci    OpenGL 1.1 is required.
225bd8deadSopenharmony_ci
235bd8deadSopenharmony_ciOverview
245bd8deadSopenharmony_ci
255bd8deadSopenharmony_ci
265bd8deadSopenharmony_ci    This extension adds new functionality to the per-vertex lighting
275bd8deadSopenharmony_ci    model of OpenGL.  It facilitates a nonlinear approximation of
285bd8deadSopenharmony_ci    reflectance functions of materials.  This extension is based upon
295bd8deadSopenharmony_ci    research conducted at Cornell University and detailed in the
305bd8deadSopenharmony_ci    SIGGRAPH 97 proceedings (LaFortune, pp. 117-126).  When active,
315bd8deadSopenharmony_ci    this reflectance model replaces diffuse and specular (and ambient?)
325bd8deadSopenharmony_ci    reflection with a single, generalized material description.
335bd8deadSopenharmony_ci
345bd8deadSopenharmony_ci    The fundamental equation for nonlinear reflectance can be expressed
355bd8deadSopenharmony_ci    as the following weighte dot-product:
365bd8deadSopenharmony_ci
375bd8deadSopenharmony_ci	Fr(u,v) = Ps*(Cx*ux*vx + Cy*uy*vy + Cz*uz*vz)^n
385bd8deadSopenharmony_ci
395bd8deadSopenharmony_ci    Where: u  = light vector at a vertex
405bd8deadSopenharmony_ci           v  = eye vector at a vertex
415bd8deadSopenharmony_ci           Ps = maximum albedo (fully-illuminated material color)
425bd8deadSopenharmony_ci           C  = nonlinear scaling coefficients
435bd8deadSopenharmony_ci           n  = specular exponent (~shininess)
445bd8deadSopenharmony_ci
455bd8deadSopenharmony_ci    The magnitude of the C vector equals (n+2)/2pi and represents the
465bd8deadSopenharmony_ci    normalization constant.
475bd8deadSopenharmony_ci
485bd8deadSopenharmony_ci    A given material will be influenced by a number Ps, C coeffients
495bd8deadSopenharmony_ci    (analagous to specular, diffuse, ambient components in the basic
505bd8deadSopenharmony_ci    OpenGL lighting model).  As in the OpenGL 1.1 lighting model, the
515bd8deadSopenharmony_ci    final color for a point is expressed as a sum of equations of the
525bd8deadSopenharmony_ci    same format as Fr:
535bd8deadSopenharmony_ci
545bd8deadSopenharmony_ci
555bd8deadSopenharmony_ci	Fr(u,v) = Sum(i,N)(Cx,i*ux*vx + Cy,i*uy*vy + Cz,i*uz*vz)^ni
565bd8deadSopenharmony_ci
575bd8deadSopenharmony_ci    Where the reflectance at a point is defined by the sum of N
585bd8deadSopenharmony_ci    expressions.  Each dot product is characterized by the following
595bd8deadSopenharmony_ci    coefficients:
605bd8deadSopenharmony_ci
615bd8deadSopenharmony_ci	Ci = coefficient vectors with with color absorbed
625bd8deadSopenharmony_ci        ni = specular exponents
635bd8deadSopenharmony_ci
645bd8deadSopenharmony_ci    In the context of OpenGL, it makes sense to make the magnitude of
655bd8deadSopenharmony_ci    Ci be (ni+2)/2pi and keep the color (RGBA) vector separate.
665bd8deadSopenharmony_ci
675bd8deadSopenharmony_ci    This extension will be implemented in the OpenGL pipeline directly
685bd8deadSopenharmony_ci    in place of the per-vertex specular, diffuse lighting.  
695bd8deadSopenharmony_ci
705bd8deadSopenharmony_ciIssues
715bd8deadSopenharmony_ci
725bd8deadSopenharmony_ci    *   Should ambient lighting calculations remain active when nonlinear
735bd8deadSopenharmony_ci        reflectance is enabled?
745bd8deadSopenharmony_ci
755bd8deadSopenharmony_ci    *   Should we only allow a single Alpha component to be used, as in
765bd8deadSopenharmony_ci        the OpenGL 1.1 model?
775bd8deadSopenharmony_ci
785bd8deadSopenharmony_ci    *   Because of the potentially large amount of data associated (relative
795bd8deadSopenharmony_ci        to OpenGL 1.1 materials) with a material, should a "Material Object"
805bd8deadSopenharmony_ci        extension be considered?
815bd8deadSopenharmony_ci
825bd8deadSopenharmony_ci    *	Should Nonlinear Lighting be allowed in Color_Index mode?
835bd8deadSopenharmony_ci
845bd8deadSopenharmony_ci    *	Should the vertex colors be clamped positive?  This will inhibit multipassing...
855bd8deadSopenharmony_ci
865bd8deadSopenharmony_ci    *	Are there any dependencies on other extensions?
875bd8deadSopenharmony_ci
885bd8deadSopenharmony_ci
895bd8deadSopenharmony_ciNew Procedures and Functions
905bd8deadSopenharmony_ci 
915bd8deadSopenharmony_ci    Because of the potentially large number of nonlinear terms, special
925bd8deadSopenharmony_ci    "Nonlin" versions of Material, Light have been added in this extension.
935bd8deadSopenharmony_ci    These functions affect lighting state in a manner identical to Material
945bd8deadSopenharmony_ci    and Light, with a different calling convention.
955bd8deadSopenharmony_ci
965bd8deadSopenharmony_ci    void NonlinMaterialfvSGIX(enum face, enum pname, int terms, const float *params);
975bd8deadSopenharmony_ci    void GetNonlinMaterialfvSGIX(enum face, enum pname, int *terms, const float *data);
985bd8deadSopenharmony_ci
995bd8deadSopenharmony_ci    void NonlinLightfvSGIX(enum light, enum pname, int terms, float *params);
1005bd8deadSopenharmony_ci    void GetNonlinLightfvSGIX(enum light, enum pname, int *terms, float *data);
1015bd8deadSopenharmony_ci
1025bd8deadSopenharmony_ciNew Tokens
1035bd8deadSopenharmony_ci
1045bd8deadSopenharmony_ci    Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, by
1055bd8deadSopenharmony_ci    the <pname> parameters of GetBooleanv, GetIntegerv, GetFloatv, and 
1065bd8deadSopenharmony_ci    GetDoublev:
1075bd8deadSopenharmony_ci
1085bd8deadSopenharmony_ci    NONLIN_LIGHTING_SGIX                                 0x????
1095bd8deadSopenharmony_ci
1105bd8deadSopenharmony_ci    Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv,
1115bd8deadSopenharmony_ci    and GetDoublev:
1125bd8deadSopenharmony_ci
1135bd8deadSopenharmony_ci    MAX_NONLIN_TERMS_SGIX                                0x????
1145bd8deadSopenharmony_ci    MAX_NONLIN_LIGHTS_SGIX                               0x????+1
1155bd8deadSopenharmony_ci    
1165bd8deadSopenharmony_ci    Accepted by the <pname> parameter of NonlinMaterialv, NonlinLightv:
1175bd8deadSopenharmony_ci
1185bd8deadSopenharmony_ci    COLOR_SGIX                                           0x????
1195bd8deadSopenharmony_ci
1205bd8deadSopenharmony_ci    Accepted by the <pname> parameter of NonlinMaterialv:
1215bd8deadSopenharmony_ci
1225bd8deadSopenharmony_ci    WEIGHT_SGIX                                          0x????
1235bd8deadSopenharmony_ci
1245bd8deadSopenharmony_ci
1255bd8deadSopenharmony_ciAdditions to Chapter 2 of the 1.1 Specification (OpenGL Operation)
1265bd8deadSopenharmony_ci
1275bd8deadSopenharmony_ci    Section 2.13.1 Lighting
1285bd8deadSopenharmony_ci
1295bd8deadSopenharmony_ci    ... <paragraph 2>
1305bd8deadSopenharmony_ci    Lighting may be in one of three states:
1315bd8deadSopenharmony_ci
1325bd8deadSopenharmony_ci    ...
1335bd8deadSopenharmony_ci    2.  Lighting On, Nonlinear Reflectance Disabled.  In this state,
1345bd8deadSopenharmony_ci        a vertex's color is found by computing a value given the
1355bd8deadSopenharmony_ci        current lighting parameters and using the specular/diffuse 
1365bd8deadSopenharmony_ci        reflectance model.
1375bd8deadSopenharmony_ci
1385bd8deadSopenharmony_ci    3.  Lighting On, Nonlinear Reflectance Enabled.  In this state,
1395bd8deadSopenharmony_ci        a vertex's color is found by computing a value given the
1405bd8deadSopenharmony_ci        current lighting parameters and using the nonlinear reflectance
1415bd8deadSopenharmony_ci        model. 
1425bd8deadSopenharmony_ci
1435bd8deadSopenharmony_ci    Lighting is turned either on or off using the generic Enable or
1445bd8deadSopenharmony_ci    Disable commands with the symbolic value LIGHTING.  Nonlinear
1455bd8deadSopenharmony_ci    Reflectance is turned either on or off using the generic Enable or
1465bd8deadSopenharmony_ci    Disable commands with the symbolic value NONLIN_LIGHTING_SGIX.
1475bd8deadSopenharmony_ci    Nonlinear Reflectance has no effect if lighting is off.
1485bd8deadSopenharmony_ci
1495bd8deadSopenharmony_ci    ...<paragraph 3 - Lighting Operation>
1505bd8deadSopenharmony_ci    A lighting parameter is one of seven types: color, position, direction,
1515bd8deadSopenharmony_ci    weight, real, int, or boolean.
1525bd8deadSopenharmony_ci    ...
1535bd8deadSopenharmony_ci    A weight parameter consists of 3 floating-point elements, one for
1545bd8deadSopenharmony_ci    each of Cx, Cy, and Cz, in that order.  There are no restrictions on
1555bd8deadSopenharmony_ci    the allowable values for the weight parameter.
1565bd8deadSopenharmony_ci    ...
1575bd8deadSopenharmony_ci    An int parameter is one integer value.
1585bd8deadSopenharmony_ci
1595bd8deadSopenharmony_ci    ...<table 2.7>
1605bd8deadSopenharmony_ci    Nonlinear Material Parameters
1615bd8deadSopenharmony_ci    wcm,j      weight        (0.0,0.0,0.0)     jth reflectance weight of material
1625bd8deadSopenharmony_ci    srm,j       real              1.0          jth specular exponent of material
1635bd8deadSopenharmony_ci    ccm,j       color      (0.8,0.8,0.8,1.0)   jth color of material
1645bd8deadSopenharmony_ci    tnlm         int               0           Maximum (j+1) of material
1655bd8deadSopenharmony_ci    ...
1665bd8deadSopenharmony_ci    Nonlinear Light Source Parameters
1675bd8deadSopenharmony_ci    ncli,j(i=0) color      (1.0,1.0,1.0,1.0)   jth intensity of light 0
1685bd8deadSopenharmony_ci    ncli,j(i>0) color      (0.0,0.0,0.0,1.0)   jth intensity of light i
1695bd8deadSopenharmony_ci    tnll         int               0           Maximum (j+1) light
1705bd8deadSopenharmony_ci
1715bd8deadSopenharmony_ci    ...<Page 45>
1725bd8deadSopenharmony_ci    If nonlinear reflectance is disabled, the color c produced...
1735bd8deadSopenharmony_ci    ...If nonlinear reflectance is enabled, the color c produced by lighting a
1745bd8deadSopenharmony_ci    vertex is given by
1755bd8deadSopenharmony_ci    
1765bd8deadSopenharmony_ci    c = ecm + acm*acs +
1775bd8deadSopenharmony_ci
1785bd8deadSopenharmony_ci	sum<i=0,n-1>(sum<j=0,min(tnlm, tnll)-1>(acm*acli +
1795bd8deadSopenharmony_ci                     (fi)(nx*hx*wcmx,j + ny*hy*wcmy,j + nz*hz*wcmzj)^srm,j *
1805bd8deadSopenharmony_ci                          ccm,j*ncli,j))
1815bd8deadSopenharmony_ci
1825bd8deadSopenharmony_ci    Section 2.13.2  Lighting Parameter Specification
1835bd8deadSopenharmony_ci
1845bd8deadSopenharmony_ci    ... <paragraph 1.5>
1855bd8deadSopenharmony_ci    ...Material...
1865bd8deadSopenharmony_ci    void NonlinMaterial{f}v( enum face, enum pname, int terms, T params ) ;
1875bd8deadSopenharmony_ci    ...Light...
1885bd8deadSopenharmony_ci    void NonlinLight{f}v( enum light, enum pname, int terms, T params ) ;
1895bd8deadSopenharmony_ci
1905bd8deadSopenharmony_ci    ... <paragraph 2>
1915bd8deadSopenharmony_ci    ... params is a pointer... terms is an integer indicating how many terms
1925bd8deadSopenharmony_ci    of a nonlinear lighting equation are being specified by a function call.
1935bd8deadSopenharmony_ci 
1945bd8deadSopenharmony_ci    ...For the Material or NonlinMaterial commands, face must be one of...
1955bd8deadSopenharmony_ci
1965bd8deadSopenharmony_ci    ... <table 2.8>
1975bd8deadSopenharmony_ci
1985bd8deadSopenharmony_ci    Nonlinear Material Parameters(NonlinMaterial)
1995bd8deadSopenharmony_ci    wcm,j	WEIGHT		3*terms
2005bd8deadSopenharmony_ci    ccm,j	COLOR		4*terms
2015bd8deadSopenharmony_ci    srm,j	SHININESS       terms
2025bd8deadSopenharmony_ci    tnlm	terms		1
2035bd8deadSopenharmony_ci
2045bd8deadSopenharmony_ci    ...
2055bd8deadSopenharmony_ci
2065bd8deadSopenharmony_ci    Nonlinear Light Source Parameters(NonlinLight)
2075bd8deadSopenharmony_ci    
2085bd8deadSopenharmony_ci    ncli,j	COLOR		4*terms
2095bd8deadSopenharmony_ci    tnll	terms		1
2105bd8deadSopenharmony_ci
2115bd8deadSopenharmony_ci    Section 2.13.3  ColorMaterial
2125bd8deadSopenharmony_ci
2135bd8deadSopenharmony_ci    ... <paragraph 1>
2145bd8deadSopenharmony_ci    ...by calling Enable or Disable with the symbolic value COLOR_MATERIAL.
2155bd8deadSopenharmony_ci    The error INVALID_OPERATION is generated if COLOR_MATERIAL is Enabled
2165bd8deadSopenharmony_ci    while NONLIN_LIGHTING is enabled.
2175bd8deadSopenharmony_ci
2185bd8deadSopenharmony_ci    Section 2.14.4  Lighting State
2195bd8deadSopenharmony_ci
2205bd8deadSopenharmony_ci    ... <paragraph 1>
2215bd8deadSopenharmony_ci    ...The state required...a bit indicating whether or not NONLINEAR_LIGHTING
2225bd8deadSopenharmony_ci    is enabled, and a single...
2235bd8deadSopenharmony_ci
2245bd8deadSopenharmony_ci
2255bd8deadSopenharmony_ci
2265bd8deadSopenharmony_ciAdditions to Chapter 3 of the 1.1 Specification (Rasterization)
2275bd8deadSopenharmony_ci
2285bd8deadSopenharmony_ci    None
2295bd8deadSopenharmony_ci
2305bd8deadSopenharmony_ciAdditions to Chapter 4 of the 1.1 Specification (Per-Fragment Operations
2315bd8deadSopenharmony_ciand the Frame Buffer)
2325bd8deadSopenharmony_ci
2335bd8deadSopenharmony_ci    None
2345bd8deadSopenharmony_ci
2355bd8deadSopenharmony_ciAdditions to Chapter 5 of the 1.1 Specification (Special Functions)
2365bd8deadSopenharmony_ci
2375bd8deadSopenharmony_ci    None
2385bd8deadSopenharmony_ci
2395bd8deadSopenharmony_ciAdditions to Chapter 6 of the 1.1 Specification (State and State Requests)
2405bd8deadSopenharmony_ci
2415bd8deadSopenharmony_ci    ... <page 145, list  of functions>
2425bd8deadSopenharmony_ci
2435bd8deadSopenharmony_ci    void GetNonlinLight{f}v( enum light, enum value, int *terms, T *data ) ;
2445bd8deadSopenharmony_ci    void GetNonlinMaterial{f}v( enum face, enum value, int *terms, T *data ) ;
2455bd8deadSopenharmony_ci
2465bd8deadSopenharmony_ci    ... <page 145, new paragraph between GetMaterial and GetTexParameter>
2475bd8deadSopenharmony_ci
2485bd8deadSopenharmony_ci    GetNonlinLight and GetNonlinMaterial are similar to their GetLight
2495bd8deadSopenharmony_ci    and GetMaterial counterparts, except that they return by reference
2505bd8deadSopenharmony_ci    the number of terms (int *terms) and an array of parameters (T *data).
2515bd8deadSopenharmony_ci    The *data pointer passed to GetNonlinMaterial and GetNonlinLight should
2525bd8deadSopenharmony_ci    point to an array large enough to contain MAX_NONLIN_TERMS*components, 
2535bd8deadSopenharmony_ci    where components equals the number of floats comprising a datum.
2545bd8deadSopenharmony_ci
2555bd8deadSopenharmony_ci    ... <table 6.3>
2565bd8deadSopenharmony_ci    W    Weight (floating-point Cx, Cy, Cz values)
2575bd8deadSopenharmony_ci
2585bd8deadSopenharmony_ciAdditions to the GLX Specification
2595bd8deadSopenharmony_ci
2605bd8deadSopenharmony_ci    TBD
2615bd8deadSopenharmony_ci
2625bd8deadSopenharmony_ciDependencies on SGI_extension_name
2635bd8deadSopenharmony_ci
2645bd8deadSopenharmony_ci    None?
2655bd8deadSopenharmony_ci
2665bd8deadSopenharmony_ciErrors
2675bd8deadSopenharmony_ci
2685bd8deadSopenharmony_ci    INVALID_OPERATION is generated if the user attempts to enable both
2695bd8deadSopenharmony_ci    COLOR_MATERIAL and NONLINEAR_LIGHTING, irregardless of order.
2705bd8deadSopenharmony_ci
2715bd8deadSopenharmony_ci    INVALID_ENUM is generated if NonlinLight{f}vSGIX parameter <pname> is not
2725bd8deadSopenharmony_ci    COLOR or <light> is not valid (LIGHT{0..MAX_NONLIN_LIGHTS-1}.
2735bd8deadSopenharmony_ci
2745bd8deadSopenharmony_ci    INVALID_VALUE is generated if NonlinLight{f}vSGIX parameter <terms> is
2755bd8deadSopenharmony_ci    outside the range [0..MAX_NONLIN_TERMS).
2765bd8deadSopenharmony_ci
2775bd8deadSopenharmony_ci    INVALID_OPERATION is generated if the number of terms for an active 
2785bd8deadSopenharmony_ci    light differs from the current material, or if the number of terms
2795bd8deadSopenharmony_ci    for SHININESS, WEIGHTS and COLOR differ.  This error results from
2805bd8deadSopenharmony_ci    primitive specification.
2815bd8deadSopenharmony_ci
2825bd8deadSopenharmony_ci    INVALID_ENUM is generated if NonlinMaterial{T}vSGIX parameter <face> is
2835bd8deadSopenharmony_ci    not FRONT, BACK, or FRONT_AND_BACK.
2845bd8deadSopenharmony_ci
2855bd8deadSopenharmony_ci    INVALID_ENUM is generated if NonlinMaterial{T}vSGIX parameter <pname> is
2865bd8deadSopenharmony_ci    not COLOR, SHININESS, or WEIGHT.
2875bd8deadSopenharmony_ci
2885bd8deadSopenharmony_ci    INVALID_VALUE is generated if NonlinMaterial{T}vSGIX parameter <terms> is
2895bd8deadSopenharmony_ci    outside the range [0..MAX_NONLIN_TERMS).
2905bd8deadSopenharmony_ci
2915bd8deadSopenharmony_ci    INVALID_ENUM is generated if GetNonlinLight{t}vSGIX parameter <light>  
2925bd8deadSopenharmony_ci    is not valid (LIGHT{0..MAX_NONLIN_LIGHTS-1}.
2935bd8deadSopenharmony_ci
2945bd8deadSopenharmony_ci    INVALID_ENUM is generated if GetNonlinLight{t}vSGIX parameter <pname>
2955bd8deadSopenharmony_ci    is not COLOR.
2965bd8deadSopenharmony_ci
2975bd8deadSopenharmony_ci    INVALID_ENUM is generated if GetNonlinMaterial{t}vSGIX parameter <face>
2985bd8deadSopenharmony_ci    is not FRONT, BACK, or FRONT_AND_BACK.
2995bd8deadSopenharmony_ci
3005bd8deadSopenharmony_ci    INVALID_ENUM is generated if GetNonlinMaterial{t}vSGIX parameter <pname>
3015bd8deadSopenharmony_ci    is not COLOR, SHININESS, or WEIGHT.
3025bd8deadSopenharmony_ci
3035bd8deadSopenharmony_ciNew State
3045bd8deadSopenharmony_ci									Initial
3055bd8deadSopenharmony_ci    Get Value				Get Command		Type	Value		Attrib
3065bd8deadSopenharmony_ci    ---------				-----------		----	-------		------
3075bd8deadSopenharmony_ci
3085bd8deadSopenharmony_ci    NONLINEAR_LIGHTING_SGIX		IsEnabled		B	False		lighting/enable
3095bd8deadSopenharmony_ci    COLOR_SGIX				GetNonlinLightfvSGIX	1*xC    ()		lighting
3105bd8deadSopenharmony_ci    COLOR_SGIX				GetNonlinMaterialfvSGIX	1*xC	()		lighting
3115bd8deadSopenharmony_ci    WEIGHT_SGIX				GetNonlinMaterialfvSGIX	1*xW	(1.0,1.0,1.0)	lighting
3125bd8deadSopenharmony_ci    SHININESS				GetNonlinMaterialfvSGIX 1*xR	1.0		lighting
3135bd8deadSopenharmony_ci    (material color terms)		GetNonlinMaterialfvSGIX	Z+	0		lighting
3145bd8deadSopenharmony_ci    (light color terms)			GetNonlinLightfvSGIX	Z+	0		lighting
3155bd8deadSopenharmony_ci    (material weight terms)		GetNonlinMaterialfvSGIX	Z+	0		lighting
3165bd8deadSopenharmony_ci    (material shininess terms)		GetNonlinMaterialfvSGIX	Z+	0		lighting
3175bd8deadSopenharmony_ci
3185bd8deadSopenharmony_ci
3195bd8deadSopenharmony_ciNew Implementation Dependent State
3205bd8deadSopenharmony_ci										Minimum
3215bd8deadSopenharmony_ci    Get Value				Get Command		Type		Value
3225bd8deadSopenharmony_ci    ---------				-----------		----		-------
3235bd8deadSopenharmony_ci    MAX_NONLIN_LIGHTS_SGIX		GetInteger		Z+              1
3245bd8deadSopenharmony_ci    MAX_NONLIN_TERMS_SGIX		GetIngeger		Z+		12