• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    EXT_polygon_offset
4
5Name String
6
7    GL_EXT_polygon_offset
8
9Version
10
11    $Date: 1995/06/17 03:34:49 $ $Revision: 1.12 $
12
13Number
14
15    3
16
17Dependencies
18
19    None
20
21Overview
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
35New Procedures and Functions
36
37    void PolygonOffsetEXT(float factor,
38                          float bias);
39
40New 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
54Additions to Chapter 2 of the GL Specification (OpenGL Operation)
55
56    None
57
58Additions 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                             2         2
93        maxdZ = sqrt[ (dZ/dX) + (dZ/dY) ]
94
95
96                ((Yc - Yb) * (Zb - Za)) - ((Yb - Ya) * (Zc - Zb))
97        dZ/dX = -------------------------------------------------
98                                       area
99
100
101                ((Xb - Xa) * (Zc - Zb)) - ((Xc - Xb) * (Zb - Za))
102        dZ/dY = -------------------------------------------------
103                                       area
104
105
106        area = ((Xb - Xa) * (Yc - Yb)) - ((Xc - Xb) * (Yb - Ya))
107
108
109    To simplify the calculations, maxdZ may be approximated by
110
111
112        maxdZ = maximum( |dZ/dX| , |dZ/dY| )
113
114
115    Note that all these equations treat window coordinate Z values as
116    ranging from 0.0 through 1.0, regardless of their actual representation
117    (refer to Controlling the Viewport in Chapter 2 of the GL Specification).
118
119    POLYGON_OFFSET_EXT is enabled and disabled using Enable and Disable with
120    parameter <cap> specified as POLYGON_OFFSET_EXT.
121
122Additions to Chapter 4 of the GL Specification (Per-Fragment Operations
123and the Framebuffer)
124
125    None
126
127Additions to Chapter 5 of the GL Specification (Special Functions)
128
129    None
130
131Additions to Chapter 6 of the GL Specification (State and State Requests)
132
133    None
134
135Additions to the GLX Specification
136
137    None
138
139GLX Protocol
140
141    A new GL rendering command is added. The following command is sent to the
142    server as part of a glXRender request:
143
144
145        PolygonOffsetEXT
146            2           12              rendering command length
147            2           4098            rendering command opcode
148            4           FLOAT32         factor
149            4           FLOAT32         bias
150
151Errors
152
153    INVALID_OPERATION is generated if PolygonOffsetEXT is called between
154    execution of Begin and the corresponding execution of End.
155
156New State
157
158                                                        Initial
159    Get Value                   Get Command     Type    Value   Attrib
160    ---------                   -----------     ----    ------- ------
161    POLYGON_OFFSET_EXT          IsEnabled       B       False   polygon/enable
162    POLYGON_OFFSET_FACTOR_EXT   GetFloatv       R       0       polygon
163    POLYGON_OFFSET_BIAS_EXT     GetFloatv       R       0       polygon
164
165New Implementation Dependent State
166
167    None
168