blob: 5d3798d9245cef02701dfb6a5e0037b2c1d2152a [file] [log] [blame]
Name Strings
Jeff Bolz, NVIDIA Corporation (jbolz 'at'
Jeff Bolz, NVIDIA Corporation
James Helferty, NVIDIA Corporation
Last Modified Date: March 27, 2015
Revision: 2
OpenGL Extension #466
OpenGL ES Extension #232
This extension is written against the OpenGL 4.3 Specification
(Compatibility Profile).
This extension interacts with OpenGL ES 3.1 (June 4, 2014)
If implemented in OpenGL ES, NV_polygon_mode is required.
This extension adds a new PolygonMode setting where a triangle is
rasterized by computing and filling its axis-aligned screen-space bounding
box, disregarding the actual triangle edges. This can be useful for
drawing a rectangle without being split into two triangles with an
internal edge. It is also useful to minimize the number of primitives
that need to be drawn, particularly for a user-interface.
New Procedures and Functions
New Tokens
Additions to Chapter 14 of the OpenGL 4.3 (Compatibility Profile) Specification
(Fixed-Function Primitive Assembly and Rasterization)
Modify Section 14.6.4 (Options Controlling Polygon Rasterization)
The interpretation of polygons for rasterization is controlled using
void PolygonMode(enum face, enum mode);
<face> is one of FRONT, BACK, or FRONT_AND_BACK, indicating that the
rasterizing method described by mode respectively replaces the rasterizing
method for front-facing polygons, back-facing polygons, or both front- and
back-facing polygons. <mode> is one of the symbolic constants POINT, LINE,
FILL, or FILL_RECTANGLE_NV. Calling PolygonMode with POINT causes certain
vertices of a polygon to be treated, for rasterization purposes, as if they
had been drawn with mode POINTS. The vertices selected for this treatment
are those that have been tagged as having a polygon boundary edge beginning
on them (see section 10.1.17). LINE causes edges that are tagged as
boundary to be rasterized as line segments. (The line stipple counter is
reset at the beginning of the first rasterized edge of the polygon, but not
for subsequent edges.) FILL is the default mode of polygon rasterization,
corresponding to the description in sections 14.6.1, 14.6.2, and 14.6.3.
Note that these modes affect only the final rasterization of polygons: in
particular, a polygon's vertices are lit, and the polygon is clipped and
possibly culled before these modes are applied.
FILL_RECTANGLE_NV mode modifies triangle rasterization to consider a sample
within the primitive if the sample location is inside the window-aligned
bounding box of the triangle after projection. Note that the barycentric
weights used in attribute interpolation may be outside the range [0,1]
when these primitives are shaded. Special treatment is given to a sample
position on the boundary edge of the bounding box. In such a case we
require that if two rectangles lie on either side of a common edge (with
identical endpoints) on which a sample position lies, then exactly one of
the triangles results in the production of the fragment during
Polygons rendered with FILL_RECTANGLE_NV mode may be clipped by the
frustum or by user clip planes, in an implementation-dependent manner.
If clipping is applied, the triangle is culled rather than clipped. When
quads and polygons are rendered in this mode, they will be tessellated
and rasterized as independent triangles (the order of tessellation within
a primitive is undefined).
Polygon antialiasing applies only to the FILL state of PolygonMode. Polygon
antialiasing does not apply to the FILL_RECTANGLE_NV mode. For POINT or
LINE, point antialiasing or line segment antialiasing, respectively, apply.
An INVALID_OPERATION error is generated by Begin or any Draw command if
only one of the front and back polygon mode is FILL_RECTANGLE_NV.
New Implementation Dependent State
New State
Additions to the AGL/GLX/WGL Specifications
GLX Protocol
Modifications to the OpenGL Shading Language Specification, Version 4.30
An INVALID_OPERATION error is generated by Begin or any Draw command if
only one of the front and back polygon mode is FILL_RECTANGLE_NV.
Interactions with OpenGL 4.3 (Core Profile) and OpenGL ES 3.1
If the OpenGL core profile or OpenGL ES is used, references to Begin, line
stipple, user clip planes, separate front and back polygon modes, polygon
primitives and quad primitives should be removed.
Interactions with OpenGL ES 3.1
Using this extension in OpenGL ES 3.1, the tokens from OpenGL should be
considered to refer to equivalent tokens from the NV_polygon_mode
extension, with an "_NV" suffix: POINT, LINE, FILL, POLYGON_OFFSET_POINT,
and POLYGON_OFFSET_LINE. References to PolygonMode should be considered
to refer to PolygonModeNV. References to point, line, and polygon
antialiasing should be removed.
(1) Where in the pipeline does the conversion from triangle to screen-
aligned bbox occur?
RESOLVED: The new rasterization mode applies during rasterization, not
earlier. So transform feedback would write out the triangle as if it were
being FILLed normally, and the triangle may have started life as a
different type of primitive (e.g. point or line) before being converted to
a triangle by a geometry shader.
(2) What happens if such a triangle is clipped?
RESOLVED: Clipping will cause the triangle to be discarded.
(3) How are quads and polygons handled? Are they decomposed into triangles?
RESOLVED: When using FILL_RECTANGLE_NV, quads and polygons are decomposed
into triangles in an implementation-dependent manner, similar to the
behavior used in transform feedback.
(4) Do these triangles still have a facingness?
RESOLVED: Yes. Face culling is still applied, and the orientation of such
a primitive is still observable in the fragment shader (gl_FrontFacing).
(5) How is polygon offset applied?
RESOLVED: Polygon offset is computed and applied normally to the fill
rectangle, using the same techniques used for triangle rasterization.
If the Z values for the vertices of the fill primitive are not constant,
the slope-dependent portion of the polygon offset will be computed using
the three vertices specified. That seems reasonable, since per-pixel Z
will be interpolated using the same slopes.
However, when using floating-point depth buffers, the meaning of the
constant portion of polygon offset will scaled according to the Z values
of the three vertices specified for the fill rectangle. Since the
interpolated Z values for the fill rectangle may fall outside the range of
Z values in the primitive, it's possible that this rescaled constant
offset is too small for portions of the fill rectangle where
"extrapolated" Z values are larger than any of the Z values of the
original triangle. This issue will require a workaround in application
code in the unlikely event that it applies.
Revision History
Revision 2, 2015/03/27
- Add ES interactions
Revision 1
- Internal revisions.