• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1Name
2
3    NV_fill_rectangle
4
5Name Strings
6
7    GL_NV_fill_rectangle
8
9Contact
10
11    Jeff Bolz, NVIDIA Corporation (jbolz 'at' nvidia.com)
12
13Contributors
14
15    Jeff Bolz, NVIDIA Corporation
16    James Helferty, NVIDIA Corporation
17
18Status
19
20    Shipping
21
22Version
23
24    Last Modified Date:         March 27, 2015
25    Revision:                   2
26
27Number
28
29    OpenGL Extension #466
30    OpenGL ES Extension #232
31
32Dependencies
33
34    This extension is written against the OpenGL 4.3 Specification
35    (Compatibility Profile).
36
37    This extension interacts with OpenGL ES 3.1 (June 4, 2014)
38
39    If implemented in OpenGL ES, NV_polygon_mode is required.
40
41Overview
42
43    This extension adds a new PolygonMode setting where a triangle is
44    rasterized by computing and filling its axis-aligned screen-space bounding
45    box, disregarding the actual triangle edges. This can be useful for
46    drawing a rectangle without being split into two triangles with an
47    internal edge.  It is also useful to minimize the number of primitives
48    that need to be drawn, particularly for a user-interface.
49
50New Procedures and Functions
51
52    None.
53
54New Tokens
55
56        FILL_RECTANGLE_NV                            0x933C
57
58Additions to Chapter 14 of the OpenGL 4.3 (Compatibility Profile) Specification
59(Fixed-Function Primitive Assembly and Rasterization)
60
61    Modify Section 14.6.4 (Options Controlling Polygon Rasterization)
62
63    The interpretation of polygons for rasterization is controlled using
64
65        void PolygonMode(enum face, enum mode);
66
67    <face> is one of FRONT, BACK, or FRONT_AND_BACK, indicating that the
68    rasterizing method described by mode respectively replaces the rasterizing
69    method for front-facing polygons, back-facing polygons, or both front- and
70    back-facing polygons. <mode> is one of the symbolic constants POINT, LINE,
71    FILL, or FILL_RECTANGLE_NV. Calling PolygonMode with POINT causes certain
72    vertices of a polygon to be treated, for rasterization purposes, as if they
73    had been drawn with mode POINTS. The vertices selected for this treatment
74    are those that have been tagged as having a polygon boundary edge beginning
75    on them (see section 10.1.17). LINE causes edges that are tagged as
76    boundary to be rasterized as line segments. (The line stipple counter is
77    reset at the beginning of the first rasterized edge of the polygon, but not
78    for subsequent edges.) FILL is the default mode of polygon rasterization,
79    corresponding to the description in sections 14.6.1, 14.6.2, and 14.6.3.
80    Note that these modes affect only the final rasterization of polygons: in
81    particular, a polygon's vertices are lit, and the polygon is clipped and
82    possibly culled before these modes are applied.
83
84    FILL_RECTANGLE_NV mode modifies triangle rasterization to consider a sample
85    within the primitive if the sample location is inside the window-aligned
86    bounding box of the triangle after projection. Note that the barycentric
87    weights used in attribute interpolation may be outside the range [0,1]
88    when these primitives are shaded. Special treatment is given to a sample
89    position on the boundary edge of the bounding box. In such a case we
90    require that if two rectangles lie on either side of a common edge (with
91    identical endpoints) on which a sample position lies, then exactly one of
92    the triangles results in the production of the fragment during
93    rasterization.
94
95    Polygons rendered with FILL_RECTANGLE_NV mode may be clipped by the
96    frustum or by user clip planes, in an implementation-dependent manner.
97    If clipping is applied, the triangle is culled rather than clipped. When
98    quads and polygons are rendered in this mode, they will be tessellated
99    and rasterized as independent triangles (the order of tessellation within
100    a primitive is undefined).
101
102    Polygon antialiasing applies only to the FILL state of PolygonMode. Polygon
103    antialiasing does not apply to the FILL_RECTANGLE_NV mode. For POINT or
104    LINE, point antialiasing or line segment antialiasing, respectively, apply.
105
106    An INVALID_OPERATION error is generated by Begin or any Draw command if
107    only one of the front and back polygon mode is FILL_RECTANGLE_NV.
108
109
110New Implementation Dependent State
111
112    None.
113
114New State
115
116    None.
117
118Additions to the AGL/GLX/WGL Specifications
119
120    None.
121
122GLX Protocol
123
124    None.
125
126Modifications to the OpenGL Shading Language Specification, Version 4.30
127
128    None.
129
130Errors
131
132    An INVALID_OPERATION error is generated by Begin or any Draw command if
133    only one of the front and back polygon mode is FILL_RECTANGLE_NV.
134
135Interactions with OpenGL 4.3 (Core Profile) and OpenGL ES 3.1
136
137    If the OpenGL core profile or OpenGL ES is used, references to Begin, line
138    stipple, user clip planes, separate front and back polygon modes, polygon
139    primitives and quad primitives should be removed.
140
141Interactions with OpenGL ES 3.1
142
143    Using this extension in OpenGL ES 3.1, the tokens from OpenGL should be
144    considered to refer to equivalent tokens from the NV_polygon_mode
145    extension, with an "_NV" suffix:  POINT, LINE, FILL, POLYGON_OFFSET_POINT,
146    and POLYGON_OFFSET_LINE.  References to PolygonMode should be considered
147    to refer to PolygonModeNV.  References to point, line, and polygon
148    antialiasing should be removed.
149
150Issues
151
152    (1) Where in the pipeline does the conversion from triangle to screen-
153    aligned bbox occur?
154
155    RESOLVED: The new rasterization mode applies during rasterization, not
156    earlier. So transform feedback would write out the triangle as if it were
157    being FILLed normally, and the triangle may have started life as a
158    different type of primitive (e.g. point or line) before being converted to
159    a triangle by a geometry shader.
160
161    (2) What happens if such a triangle is clipped?
162
163    RESOLVED: Clipping will cause the triangle to be discarded.
164
165    (3) How are quads and polygons handled? Are they decomposed into triangles?
166
167    RESOLVED:  When using FILL_RECTANGLE_NV, quads and polygons are decomposed
168    into triangles in an implementation-dependent manner, similar to the
169    behavior used in transform feedback.
170
171    (4) Do these triangles still have a facingness?
172
173    RESOLVED: Yes. Face culling is still applied, and the orientation of such
174    a primitive is still observable in the fragment shader (gl_FrontFacing).
175
176    (5) How is polygon offset applied?
177
178    RESOLVED:  Polygon offset is computed and applied normally to the fill
179    rectangle, using the same techniques used for triangle rasterization.
180
181    If the Z values for the vertices of the fill primitive are not constant,
182    the slope-dependent portion of the polygon offset will be computed using
183    the three vertices specified.  That seems reasonable, since per-pixel Z
184    will be interpolated using the same slopes.
185
186    However, when using floating-point depth buffers, the meaning of the
187    constant portion of polygon offset will scaled according to the Z values
188    of the three vertices specified for the fill rectangle.  Since the
189    interpolated Z values for the fill rectangle may fall outside the range of
190    Z values in the primitive, it's possible that this rescaled constant
191    offset is too small for portions of the fill rectangle where
192    "extrapolated" Z values are larger than any of the Z values of the
193    original triangle.  This issue will require a workaround in application
194    code in the unlikely event that it applies.
195
196Revision History
197
198    Revision 2, 2015/03/27
199      - Add ES interactions
200
201    Revision 1
202      - Internal revisions.
203