1Name 2 3 NV_polygon_mode 4 5Name Strings 6 7 GL_NV_polygon_mode 8 9Contact 10 11 James Helferty, NVIDIA Corporation (jhelferty 'at' nvidia.com) 12 13Contributors 14 15 James Helferty, NVIDIA Corporation 16 Daniel Koch, NVIDIA Corporation 17 18Status 19 20 Complete 21 22Version 23 24 Last Modified Date: Sept 11, 2014 25 Revision: 1 26 27Number 28 29 OpenGL ES Extension #238 30 31Dependencies 32 33 This extension is written against the OpenGL ES 3.1 (June 4, 2014) 34 specification, but can apply to earlier versions. 35 36 This extension trivially interacts with NV_draw_texture 37 38Overview 39 40 This extension adds a PolygonModeNV entry point which can be used to change 41 the polygon rasterization method. Using this extension, state consistent 42 with rendering triangle primitives can trivially be toggled to render 43 primitives as lines or points. In addition, independent enables are 44 provided for polygon offset in conjunction with these new point and line 45 polygon modes. 46 47 This introduces a level of support for PolygonMode comparable with the 48 OpenGL 4.3 core profile. 49 50New Procedures and Functions 51 52 void PolygonModeNV(enum face, enum mode); 53 54New Tokens 55 56 Accepted by the <pname> parameter to GetIntegerv: 57 58 POLYGON_MODE_NV 0x0B40 59 60 Accepted by the <pname> parameter to IsEnabled: 61 62 POLYGON_OFFSET_POINT_NV 0x2A01 63 POLYGON_OFFSET_LINE_NV 0x2A02 64 65 Returned by GetIntegerv, GetFloatv, and GetInteger64v when <pname> is 66 POLYGON_MODE_NV: 67 68 POINT_NV 0x1B00 69 LINE_NV 0x1B01 70 FILL_NV 0x1B02 71 72Additions to Chapter 13 of the OpenGL 3.1 Specification (Fixed-Function 73Primitive Assembly and Rasterization) 74 75 Insert new section 13.5.1pm, "Options Controlling Polygon Rasterization" 76 between section 13.5.1 and 13.5.2: 77 78 The interpretation of polygons for rasterization is controlled using 79 80 void PolygonModeNV( enum face, enum mode ); 81 82 <face> must be FRONT_AND_BACK, indicating that the rasterizing method 83 described by <mode> replaces the rasterizing method for both front- and 84 back-facing polygons. <mode> is one of the symbolic constants POINT_NV, 85 LINE_NV, or FILL_NV. Calling PolygonModeNV with POINT_NV causes the 86 vertices of a polygon to be treated, for rasterization purposes, as if they 87 had been drawn with <mode> POINTS. LINE_NV causes edges to be rasterized as 88 line segments. FILL_NV is the default mode of polygon rasterization, 89 corresponding to the description in section 13.5.1. Note that these modes 90 affect only the final rasterization of polygons: in particular, a polygon's 91 vertices are lit, and the polygon is clipped and possibly culled before 92 these modes are applied. 93 94 Modify Section 13.5.2, "Depth Offset" as follows: 95 96 Replace the second-last paragraph that begins "Boolean state value 97 POLYGON_OFFSET_FILL determines whether <o> is applied during the 98 rasterization of polygons..." with: 99 100 Boolean state values POLYGON_OFFSET_POINT_NV, POLYGON_OFFSET_LINE_NV, and 101 POLYGON_OFFSET_FILL determine whether <o> is applied during the 102 rasterization of polygons in POINT_NV, LINE_NV, and FILL_NV modes. These 103 boolean state values are enabled and disabled as argument values to the 104 commands Enable and Disable. If POLYGON_OFFSET_POINT_NV is enabled, <o> is 105 added to the depth value of each fragment produced by the rasterization of 106 a polygon in POINT_NV mode. Likewise, if POLYGON_OFFSET_LINE_NV or 107 POLYGON_OFFSET_FILL is enabled, <o> is added to the depth value of each 108 fragment produced by the rasterization of a polygon in LINE_NV or FILL_NV 109 modes, respectively. 110 111 Modify Section 13.5.3, "Polygon Multisample Rasterization" as follows: 112 113 Append the paragraph: 114 115 The rasterization described above applies only to the FILL_NV state of 116 PolygonModeNV. For POINT_NV and LINE_NV, the rasterizations described in 117 sections 13.3.2 (Point Multisample Rasterization) and 13.4.4 (Line 118 Multisample Rasterization) apply. 119 120 Modify Section 13.5.4 "Polygon Rasterization State" 121 122 The state required for polygon rasterization consists of whether point, 123 line, and fill mode polygon offsets are enabled or disabled, and the factor 124 and bias values of the polygon offset equation. The initial polygon offset 125 factor and bias values are both 0; initially polygon offset is disabled for 126 all modes. The initial state for PolygonModeNV is FILL_NV. 127 128Additions to Chapter 15 of the OpenGL 3.1 Specification (Writing Fragments and 129Samples to the Framebuffer) 130 131 Modify Section 15.1.4, "Stencil Test" as follows: 132 133 Replace the third paragraph with: 134 135 There are two sets of stencil-related state, the front stencil state set 136 and the back stencil state set. Stencil tests and writes use the front set 137 of stencil state when processing fragments rasterized from non-polygon 138 primitives (points and lines) and front-facing polygon primitives while the 139 back set of stencil state is used when processing fragments rasterized from 140 back-facing polygon primitives. For the purposes of stencil testing, a 141 primitive is still considered a polygon even if the polygon is to be 142 rasterized as points or lines due to the current polygon mode. Whether a 143 polygon is front- or back-facing is determined in the same manner used for 144 face culling (see section 13.5.1). 145 146Interactions with NV_draw_texture 147 148 In NV_draw_texture, change references to PolygonMode to PolygonModeNV, and 149 disregard the interaction ignoring PolygonMode for ES. 150 151New State 152 153 Modify Table 20.6, Rasterization 154 155 Add: 156 157 Initial 158 Get Value Type Get Command Value Description Sec. 159 ----------------------- ---- ----------- ------- --------------------------- ------ 160 POLYGON_MODE_NV E GetIntegerv FILL_NV Polygon rasterization mode 13.5.1pm 161 (front & back) 162 POLYGON_OFFSET_POINT_NV B IsEnabled FALSE Polygon offset enable for 13.5.2 163 POINT_NV mode rasterization 164 POLYGON_OFFSET_LINE_NV B IsEnabled FALSE Polygon offset enable for 13.5.2 165 LINE_NV mode rasterization 166 167 Change description for POLYGON_OFFSET_FILL to "Polygon offset enable for 168 FILL_NV mode rasterization" 169 170Errors 171 172 An INVALID_ENUM error is generated by PolygonModeNV if <face> is not 173 FRONT_AND_BACK. 174 175 An INVALID_ENUM error is generated by PolygonModeNV if <mode> is not one of 176 POINT_NV, LINE_NV, or FILL_NV. 177 178Issues 179 180 1. How does PolygonModeNV interact with tessellation shaders? 181 182 See Issue 29 of ARB_tessellation_shader. 183 184Revision History 185 186 Rev. Date Author Changes 187 ---- -------- --------- ----------------------------------------- 188 1 09/10/14 jhelferty Initial revision. 189