15bd8deadSopenharmony_ciName 25bd8deadSopenharmony_ci 35bd8deadSopenharmony_ci EXT_polygon_offset 45bd8deadSopenharmony_ci 55bd8deadSopenharmony_ciName String 65bd8deadSopenharmony_ci 75bd8deadSopenharmony_ci GL_EXT_polygon_offset 85bd8deadSopenharmony_ci 95bd8deadSopenharmony_ciVersion 105bd8deadSopenharmony_ci 115bd8deadSopenharmony_ci $Date: 1995/06/17 03:34:49 $ $Revision: 1.12 $ 125bd8deadSopenharmony_ci 135bd8deadSopenharmony_ciNumber 145bd8deadSopenharmony_ci 155bd8deadSopenharmony_ci 3 165bd8deadSopenharmony_ci 175bd8deadSopenharmony_ciDependencies 185bd8deadSopenharmony_ci 195bd8deadSopenharmony_ci None 205bd8deadSopenharmony_ci 215bd8deadSopenharmony_ciOverview 225bd8deadSopenharmony_ci 235bd8deadSopenharmony_ci The depth values of fragments generated by rendering polygons are 245bd8deadSopenharmony_ci displaced by an amount that is proportional to the maximum absolute 255bd8deadSopenharmony_ci value of the depth slope of the polygon, measured and applied in window 265bd8deadSopenharmony_ci coordinates. This displacement allows lines (or points) and polygons 275bd8deadSopenharmony_ci in the same plane to be rendered without interaction -- the lines 285bd8deadSopenharmony_ci rendered either completely in front of or behind the polygons 295bd8deadSopenharmony_ci (depending on the sign of the offset factor). It also allows multiple 305bd8deadSopenharmony_ci coplanar polygons to be rendered without interaction, if different 315bd8deadSopenharmony_ci offset factors are used for each polygon. Applications include 325bd8deadSopenharmony_ci rendering hidden-line images, rendering solids with highlighted edges, 335bd8deadSopenharmony_ci and applying `decals' to surfaces. 345bd8deadSopenharmony_ci 355bd8deadSopenharmony_ciNew Procedures and Functions 365bd8deadSopenharmony_ci 375bd8deadSopenharmony_ci void PolygonOffsetEXT(float factor, 385bd8deadSopenharmony_ci float bias); 395bd8deadSopenharmony_ci 405bd8deadSopenharmony_ciNew Tokens 415bd8deadSopenharmony_ci 425bd8deadSopenharmony_ci Accepted by the <cap> parameter of Enable, Disable, and IsEnabled, and 435bd8deadSopenharmony_ci by the <pname> parameter of GetBooleanv, GetIntegerv, GetFloatv, and 445bd8deadSopenharmony_ci GetDoublev: 455bd8deadSopenharmony_ci 465bd8deadSopenharmony_ci POLYGON_OFFSET_EXT 0x8037 475bd8deadSopenharmony_ci 485bd8deadSopenharmony_ci Accepted by the <pname> parameter of GetBooleanv, GetIntegerv, 495bd8deadSopenharmony_ci GetFloatv, and GetDoublev: 505bd8deadSopenharmony_ci 515bd8deadSopenharmony_ci POLYGON_OFFSET_FACTOR_EXT 0x8038 525bd8deadSopenharmony_ci POLYGON_OFFSET_BIAS_EXT 0x8039 535bd8deadSopenharmony_ci 545bd8deadSopenharmony_ciAdditions to Chapter 2 of the GL Specification (OpenGL Operation) 555bd8deadSopenharmony_ci 565bd8deadSopenharmony_ci None 575bd8deadSopenharmony_ci 585bd8deadSopenharmony_ciAdditions to Chapter 3 of the GL Specification (Rasterization) 595bd8deadSopenharmony_ci 605bd8deadSopenharmony_ci The changes to the GL Specification are limited to the description of 615bd8deadSopenharmony_ci polygon rasterization, specifically while the polygon mode (specified 625bd8deadSopenharmony_ci by calling PolygonMode) is FILL. The GL Specification requires that 635bd8deadSopenharmony_ci fragment Z values during such rasterization be computed using the 645bd8deadSopenharmony_ci equation 655bd8deadSopenharmony_ci 665bd8deadSopenharmony_ci 675bd8deadSopenharmony_ci Z = (a * Za) + (b * Zb) + (c * Zc) 685bd8deadSopenharmony_ci 695bd8deadSopenharmony_ci 705bd8deadSopenharmony_ci where a, b, and c are the barycentric coordinates of the fragment 715bd8deadSopenharmony_ci center, and Za, Zb, and Zc are the Z values of the triangle's vertices. 725bd8deadSopenharmony_ci When POLYGON_OFFSET_EXT is enabled, this extension modifies this 735bd8deadSopenharmony_ci equation as follows: 745bd8deadSopenharmony_ci 755bd8deadSopenharmony_ci 765bd8deadSopenharmony_ci Z' = (a * Za) + (b * Zb) + (c * Zc) + (factor * maxdZ) + bias 775bd8deadSopenharmony_ci 785bd8deadSopenharmony_ci 795bd8deadSopenharmony_ci / 0 Z' < 0 805bd8deadSopenharmony_ci Z = < Z' 0 <= Z' <= 1 815bd8deadSopenharmony_ci \ 1 Z' > 1 825bd8deadSopenharmony_ci 835bd8deadSopenharmony_ci 845bd8deadSopenharmony_ci where factor and bias are the polygon offset factor and bias as 855bd8deadSopenharmony_ci specified by PolygonOffsetEXT, and maxdZ is the maximum positive change 865bd8deadSopenharmony_ci in Z for a unit-step in the X,Y plane. MaxdZ can be approximated as 875bd8deadSopenharmony_ci the larger of the absolute values of dZ/dX and dZ/dY, the rates of 885bd8deadSopenharmony_ci change of Z in the positive X and Y directions. The equations for 895bd8deadSopenharmony_ci maxdZ, dZ/dX, and dZ/dY are: 905bd8deadSopenharmony_ci 915bd8deadSopenharmony_ci 925bd8deadSopenharmony_ci 2 2 935bd8deadSopenharmony_ci maxdZ = sqrt[ (dZ/dX) + (dZ/dY) ] 945bd8deadSopenharmony_ci 955bd8deadSopenharmony_ci 965bd8deadSopenharmony_ci ((Yc - Yb) * (Zb - Za)) - ((Yb - Ya) * (Zc - Zb)) 975bd8deadSopenharmony_ci dZ/dX = ------------------------------------------------- 985bd8deadSopenharmony_ci area 995bd8deadSopenharmony_ci 1005bd8deadSopenharmony_ci 1015bd8deadSopenharmony_ci ((Xb - Xa) * (Zc - Zb)) - ((Xc - Xb) * (Zb - Za)) 1025bd8deadSopenharmony_ci dZ/dY = ------------------------------------------------- 1035bd8deadSopenharmony_ci area 1045bd8deadSopenharmony_ci 1055bd8deadSopenharmony_ci 1065bd8deadSopenharmony_ci area = ((Xb - Xa) * (Yc - Yb)) - ((Xc - Xb) * (Yb - Ya)) 1075bd8deadSopenharmony_ci 1085bd8deadSopenharmony_ci 1095bd8deadSopenharmony_ci To simplify the calculations, maxdZ may be approximated by 1105bd8deadSopenharmony_ci 1115bd8deadSopenharmony_ci 1125bd8deadSopenharmony_ci maxdZ = maximum( |dZ/dX| , |dZ/dY| ) 1135bd8deadSopenharmony_ci 1145bd8deadSopenharmony_ci 1155bd8deadSopenharmony_ci Note that all these equations treat window coordinate Z values as 1165bd8deadSopenharmony_ci ranging from 0.0 through 1.0, regardless of their actual representation 1175bd8deadSopenharmony_ci (refer to Controlling the Viewport in Chapter 2 of the GL Specification). 1185bd8deadSopenharmony_ci 1195bd8deadSopenharmony_ci POLYGON_OFFSET_EXT is enabled and disabled using Enable and Disable with 1205bd8deadSopenharmony_ci parameter <cap> specified as POLYGON_OFFSET_EXT. 1215bd8deadSopenharmony_ci 1225bd8deadSopenharmony_ciAdditions to Chapter 4 of the GL Specification (Per-Fragment Operations 1235bd8deadSopenharmony_ciand the Framebuffer) 1245bd8deadSopenharmony_ci 1255bd8deadSopenharmony_ci None 1265bd8deadSopenharmony_ci 1275bd8deadSopenharmony_ciAdditions to Chapter 5 of the GL Specification (Special Functions) 1285bd8deadSopenharmony_ci 1295bd8deadSopenharmony_ci None 1305bd8deadSopenharmony_ci 1315bd8deadSopenharmony_ciAdditions to Chapter 6 of the GL Specification (State and State Requests) 1325bd8deadSopenharmony_ci 1335bd8deadSopenharmony_ci None 1345bd8deadSopenharmony_ci 1355bd8deadSopenharmony_ciAdditions to the GLX Specification 1365bd8deadSopenharmony_ci 1375bd8deadSopenharmony_ci None 1385bd8deadSopenharmony_ci 1395bd8deadSopenharmony_ciGLX Protocol 1405bd8deadSopenharmony_ci 1415bd8deadSopenharmony_ci A new GL rendering command is added. The following command is sent to the 1425bd8deadSopenharmony_ci server as part of a glXRender request: 1435bd8deadSopenharmony_ci 1445bd8deadSopenharmony_ci 1455bd8deadSopenharmony_ci PolygonOffsetEXT 1465bd8deadSopenharmony_ci 2 12 rendering command length 1475bd8deadSopenharmony_ci 2 4098 rendering command opcode 1485bd8deadSopenharmony_ci 4 FLOAT32 factor 1495bd8deadSopenharmony_ci 4 FLOAT32 bias 1505bd8deadSopenharmony_ci 1515bd8deadSopenharmony_ciErrors 1525bd8deadSopenharmony_ci 1535bd8deadSopenharmony_ci INVALID_OPERATION is generated if PolygonOffsetEXT is called between 1545bd8deadSopenharmony_ci execution of Begin and the corresponding execution of End. 1555bd8deadSopenharmony_ci 1565bd8deadSopenharmony_ciNew State 1575bd8deadSopenharmony_ci 1585bd8deadSopenharmony_ci Initial 1595bd8deadSopenharmony_ci Get Value Get Command Type Value Attrib 1605bd8deadSopenharmony_ci --------- ----------- ---- ------- ------ 1615bd8deadSopenharmony_ci POLYGON_OFFSET_EXT IsEnabled B False polygon/enable 1625bd8deadSopenharmony_ci POLYGON_OFFSET_FACTOR_EXT GetFloatv R 0 polygon 1635bd8deadSopenharmony_ci POLYGON_OFFSET_BIAS_EXT GetFloatv R 0 polygon 1645bd8deadSopenharmony_ci 1655bd8deadSopenharmony_ciNew Implementation Dependent State 1665bd8deadSopenharmony_ci 1675bd8deadSopenharmony_ci None 168