home *** CD-ROM | disk | FTP | other *** search
/ SGI Developer Toolbox 6.1 / SGI Developer Toolbox 6.1 - Disc 1.iso / toolbox / documents / OpenGL / extensions / spec / polygon_offset.spec < prev    next >
Encoding:
Text File  |  1996-11-11  |  4.3 KB  |  161 lines

  1. Name
  2.  
  3.     EXT_polygon_offset
  4.  
  5. Name String
  6.  
  7.     GL_EXT_polygon_offset
  8.  
  9. Version
  10.  
  11.     $Date: 1995/09/30 02:32:14 $ $Revision: 1.1 $
  12.  
  13. Number
  14.  
  15.     3
  16.  
  17. Dependencies
  18.  
  19.     None
  20.  
  21. Overview
  22.  
  23.     The depth values of fragments generated by rendering polygons are
  24.     displaced by an amount that is proportional to the maximum absolute
  25.     value of the depth slope of the polygon, measured and applied in window
  26.     coordinates.  This displacement allows lines (or points) and polygons
  27.     in the same plane to be rendered without interaction -- the lines
  28.     rendered either completely in front of or behind the polygons
  29.     (depending on the sign of the offset factor).  It also allows multiple
  30.     coplanar polygons to be rendered without interaction, if different
  31.     offset factors are used for each polygon.  Applications include
  32.     rendering hidden-line images, rendering solids with highlighted edges,
  33.     and applying `decals' to surfaces.
  34.  
  35. New Procedures and Functions
  36.  
  37.     void PolygonOffsetEXT(float factor,
  38.               float bias);
  39.  
  40. New Tokens
  41.  
  42.     Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and
  43.     by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and
  44.     GetDoublev:
  45.  
  46.     POLYGON_OFFSET_EXT               0x8037
  47.  
  48.     Accepted by the <pname> parameter of GetBooleanv, GetIntegerv,
  49.     GetFloatv, and GetDoublev:
  50.  
  51.     POLYGON_OFFSET_FACTOR_EXT        0x8038
  52.     POLYGON_OFFSET_BIAS_EXT          0x8039
  53.  
  54. Additions to Chapter 2 of the GL Specification (OpenGL Operation)
  55.  
  56.     None
  57.  
  58. Additions to Chapter 3 of the GL Specification (Rasterization)
  59.  
  60.     The changes to the GL Specification are limited to the description of
  61.     polygon rasterization, specifically while the polygon mode (specified
  62.     by calling PolygonMode) is FILL.  The GL Specification requires that
  63.     fragment Z values during such rasterization be computed using the
  64.     equation
  65.  
  66.  
  67.     Z = (a * Za) + (b * Zb) + (c * Zc)
  68.  
  69.  
  70.     where a, b, and c are the barycentric coordinates of the fragment
  71.     center, and Za, Zb, and Zc are the Z values of the triangle's vertices.
  72.     When POLYGON_OFFSET_EXT is enabled, this extension modifies this
  73.     equation as follows:
  74.  
  75.  
  76.     Z' = (a * Za) + (b * Zb) + (c * Zc) + (factor * maxdZ) + bias
  77.  
  78.  
  79.          / 0    Z' < 0
  80.     Z = <  Z'    0 <= Z' <= 1
  81.          \ 1    Z' > 1
  82.  
  83.  
  84.     where factor and bias are the polygon offset factor and bias as
  85.     specified by PolygonOffsetEXT, and maxdZ is the maximum positive change
  86.     in Z for a unit-step in the X,Y plane.  MaxdZ can be approximated as
  87.     the larger of the absolute values of dZ/dX and dZ/dY, the rates of
  88.     change of Z in the positive X and Y directions.  The equations for
  89.     maxdZ, dZ/dX, and dZ/dY are:
  90.  
  91.  
  92.     maxdZ = maximum( |dZ/dX| , |dZ/dY| )
  93.  
  94.  
  95.         ((Yc - Yb) * (Zb - Za)) - ((Yb - Ya) * (Zc - Zb))
  96.     dZ/dX =    -------------------------------------------------
  97.                        area
  98.  
  99.  
  100.         ((Xb - Xa) * (Zc - Zb)) - ((Xc - Xb) * (Zb - Za))
  101.     dZ/dY =    -------------------------------------------------
  102.                        area
  103.  
  104.  
  105.     area = ((Xb - Xa) * (Yc - Yb)) - ((Xc - Xb) * (Yb - Ya))
  106.  
  107.  
  108.     Note that all these equations treat window coordinate Z values as
  109.     ranging from 0.0 through 1.0, regardless of their actual representation
  110.     (refer to Controlling the Viewport in Chapter 2 of the GL Specification).
  111.  
  112.     POLYGON_OFFSET_EXT is enabled and disabled using Enable and Disable with
  113.     parameter <cap> specified as POLYGON_OFFSET_EXT.
  114.  
  115. Additions to Chapter 4 of the GL Specification (Per-Fragment Operations
  116. and the Framebuffer)
  117.  
  118.     None
  119.  
  120. Additions to Chapter 5 of the GL Specification (Special Functions)
  121.  
  122.     None
  123.  
  124. Additions to Chapter 6 of the GL Specification (State and State Requests)
  125.  
  126.     None
  127.  
  128. Additions to the GLX Specification
  129.  
  130.     None
  131.  
  132. GLX Protocol
  133.  
  134.     A new GL rendering command is added. The following command is sent to the 
  135.     server as part of a glXRender request:
  136.  
  137.  
  138.       PolygonOffsetEXT
  139.         2        12        rendering command length
  140.         2        4098        rendering command opcode
  141.         4        FLOAT32        factor
  142.         4        FLOAT32        bias
  143.  
  144. Errors
  145.  
  146.     INVALID_OPERATION is generated if PolygonOffsetEXT is called between
  147.     execution of Begin and the corresponding execution of End.
  148.  
  149. New State
  150.  
  151.                             Initial
  152.     Get Value            Get Command    Type    Value    Attrib
  153.     ---------            -----------    ----    -------    ------
  154.     POLYGON_OFFSET_EXT        IsEnabled    B    False    polygon/enable
  155.     POLYGON_OFFSET_FACTOR_EXT    GetFloatv    R    0    polygon
  156.     POLYGON_OFFSET_BIAS_EXT    GetFloatv    R    0    polygon
  157.  
  158. New Implementation Dependent State
  159.  
  160.     None
  161.