2009-12-20 19:41:50 -08:00
|
|
|
.. _rasterizer:
|
|
|
|
|
|
2009-12-20 15:00:40 -08:00
|
|
|
Rasterizer
|
|
|
|
|
==========
|
|
|
|
|
|
2010-01-06 09:42:53 -07:00
|
|
|
The rasterizer state controls the rendering of points, lines and triangles.
|
|
|
|
|
Attributes include polygon culling state, line width, line stipple,
|
|
|
|
|
multisample state, scissoring and flat/smooth shading.
|
|
|
|
|
|
2009-12-20 15:00:40 -08:00
|
|
|
Members
|
|
|
|
|
-------
|
|
|
|
|
|
2009-12-20 17:25:36 -08:00
|
|
|
flatshade
|
2010-01-18 17:12:13 -08:00
|
|
|
^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
If set, the provoking vertex of each polygon is used to determine the color
|
|
|
|
|
of the entire polygon. If not set, fragment colors will be interpolated
|
|
|
|
|
between the vertex colors.
|
|
|
|
|
|
|
|
|
|
The actual interpolated shading algorithm is obviously
|
|
|
|
|
implementation-dependent, but will usually be Gourard for most hardware.
|
|
|
|
|
|
|
|
|
|
.. note::
|
|
|
|
|
|
|
|
|
|
This is separate from the fragment shader input attributes
|
|
|
|
|
CONSTANT, LINEAR and PERSPECTIVE. The flatshade state is needed at
|
2010-01-06 09:42:53 -07:00
|
|
|
clipping time to determine how to set the color of new vertices.
|
2010-01-18 17:12:13 -08:00
|
|
|
|
|
|
|
|
:ref:`Draw` can implement flat shading by copying the provoking vertex
|
|
|
|
|
color to all the other vertices in the primitive.
|
2010-01-06 09:42:53 -07:00
|
|
|
|
|
|
|
|
flatshade_first
|
2010-01-18 17:12:13 -08:00
|
|
|
^^^^^^^^^^^^^^^
|
|
|
|
|
|
|
|
|
|
Whether the first vertex should be the provoking vertex, for most primitives.
|
|
|
|
|
If not set, the last vertex is the provoking vertex.
|
|
|
|
|
|
|
|
|
|
There are several important exceptions to the specification of this rule.
|
|
|
|
|
|
|
|
|
|
* ``PIPE_PRIMITIVE_POLYGON``: The provoking vertex is always the first
|
|
|
|
|
vertex. If the caller wishes to change the provoking vertex, they merely
|
|
|
|
|
need to rotate the vertices themselves.
|
|
|
|
|
* ``PIPE_PRIMITIVE_QUAD``, ``PIPE_PRIMITIVE_QUAD_STRIP``: This option has no
|
|
|
|
|
effect; the provoking vertex is always the last vertex.
|
|
|
|
|
* ``PIPE_PRIMITIVE_TRIANGLE_FAN``: When set, the provoking vertex is the
|
|
|
|
|
second vertex, not the first. This permits each segment of the fan to have
|
|
|
|
|
a different color.
|
|
|
|
|
|
|
|
|
|
Other Members
|
|
|
|
|
^^^^^^^^^^^^^
|
2010-01-06 09:42:53 -07:00
|
|
|
|
|
|
|
|
light_twoside
|
2010-01-18 17:17:09 -08:00
|
|
|
If set, there are per-vertex back-facing colors. :ref:`Draw`
|
2010-01-06 09:42:53 -07:00
|
|
|
uses this state along with the front/back information to set the
|
|
|
|
|
final vertex colors prior to rasterization.
|
|
|
|
|
|
|
|
|
|
front_winding
|
|
|
|
|
Indicates the window order of front-facing polygons, either
|
|
|
|
|
PIPE_WINDING_CW or PIPE_WINDING_CCW
|
2010-01-18 17:12:13 -08:00
|
|
|
|
2010-01-06 09:42:53 -07:00
|
|
|
cull_mode
|
|
|
|
|
Indicates which polygons to cull, either PIPE_WINDING_NONE (cull no
|
|
|
|
|
polygons), PIPE_WINDING_CW (cull clockwise-winding polygons),
|
|
|
|
|
PIPE_WINDING_CCW (cull counter clockwise-winding polygons), or
|
|
|
|
|
PIPE_WINDING_BOTH (cull all polygons).
|
|
|
|
|
|
|
|
|
|
fill_cw
|
|
|
|
|
Indicates how to fill clockwise polygons, either PIPE_POLYGON_MODE_FILL,
|
|
|
|
|
PIPE_POLYGON_MODE_LINE or PIPE_POLYGON_MODE_POINT.
|
|
|
|
|
fill_ccw
|
|
|
|
|
Indicates how to fill counter clockwise polygons, either
|
|
|
|
|
PIPE_POLYGON_MODE_FILL, PIPE_POLYGON_MODE_LINE or PIPE_POLYGON_MODE_POINT.
|
|
|
|
|
|
2009-12-20 17:25:36 -08:00
|
|
|
poly_stipple_enable
|
|
|
|
|
Whether polygon stippling is enabled.
|
2010-01-06 09:42:53 -07:00
|
|
|
poly_smooth
|
|
|
|
|
Controls OpenGL-style polygon smoothing/antialiasing
|
|
|
|
|
offset_cw
|
|
|
|
|
If set, clockwise polygons will have polygon offset factors applied
|
|
|
|
|
offset_ccw
|
|
|
|
|
If set, counter clockwise polygons will have polygon offset factors applied
|
|
|
|
|
offset_units
|
|
|
|
|
Specifies the polygon offset bias
|
|
|
|
|
offset_scale
|
|
|
|
|
Specifies the polygon offset scale
|
|
|
|
|
|
|
|
|
|
line_width
|
|
|
|
|
The width of lines.
|
|
|
|
|
line_smooth
|
|
|
|
|
Whether lines should be smoothed. Line smoothing is simply anti-aliasing.
|
|
|
|
|
line_stipple_enable
|
|
|
|
|
Whether line stippling is enabled.
|
|
|
|
|
line_stipple_pattern
|
|
|
|
|
16-bit bitfield of on/off flags, used to pattern the line stipple.
|
|
|
|
|
line_stipple_factor
|
2010-01-18 17:17:09 -08:00
|
|
|
When drawing a stippled line, each bit in the stipple pattern is
|
2010-01-06 09:42:53 -07:00
|
|
|
repeated N times, where N = line_stipple_factor + 1.
|
|
|
|
|
line_last_pixel
|
|
|
|
|
Controls whether the last pixel in a line is drawn or not. OpenGL
|
|
|
|
|
omits the last pixel to avoid double-drawing pixels at the ends of lines
|
|
|
|
|
when drawing connected lines.
|
|
|
|
|
|
2009-12-20 17:25:36 -08:00
|
|
|
point_smooth
|
|
|
|
|
Whether points should be smoothed. Point smoothing turns rectangular
|
|
|
|
|
points into circles or ovals.
|
|
|
|
|
point_size_per_vertex
|
|
|
|
|
Whether vertices have a point size element.
|
2010-01-06 09:42:53 -07:00
|
|
|
point_size
|
|
|
|
|
The size of points, if not specified per-vertex.
|
2010-02-03 17:39:47 +01:00
|
|
|
sprite_coord_enable
|
|
|
|
|
Specifies if a coord has its texture coordinates replaced or not. This
|
|
|
|
|
is a packed bitfield containing the enable for all coords - if all are 0
|
2010-02-04 21:35:28 +01:00
|
|
|
point sprites are effectively disabled, though points may still be
|
|
|
|
|
rendered slightly different according to point_quad_rasterization.
|
|
|
|
|
If any coord is non-zero, point_smooth should be disabled, and
|
|
|
|
|
point_quad_rasterization enabled.
|
2010-02-03 17:39:47 +01:00
|
|
|
If enabled, the four vertices of the resulting quad will be assigned
|
|
|
|
|
texture coordinates, according to sprite_coord_mode.
|
2010-01-06 09:42:53 -07:00
|
|
|
sprite_coord_mode
|
|
|
|
|
Specifies how the value for each shader output should be computed when
|
2010-02-03 17:39:47 +01:00
|
|
|
drawing sprites, for each coord which has sprite_coord_enable set.
|
|
|
|
|
For PIPE_SPRITE_COORD_LOWER_LEFT, the lower left vertex will have
|
|
|
|
|
coordinate (0,0,0,1).
|
2010-01-06 09:42:53 -07:00
|
|
|
For PIPE_SPRITE_COORD_UPPER_LEFT, the upper-left vertex will have
|
|
|
|
|
coordinate (0,0,0,1).
|
2010-01-18 17:17:09 -08:00
|
|
|
This state is needed by :ref:`Draw` because that's where each
|
2010-01-06 09:42:53 -07:00
|
|
|
point vertex is converted into four quad vertices. There's no other
|
|
|
|
|
place to emit the new vertex texture coordinates which are required for
|
|
|
|
|
sprite rendering.
|
|
|
|
|
Note that when geometry shaders are available, this state could be
|
|
|
|
|
removed. A special geometry shader defined by the state tracker could
|
2010-02-03 17:25:14 +01:00
|
|
|
convert the incoming points into quads with the proper texture coords.
|
2010-02-04 21:35:28 +01:00
|
|
|
point_quad_rasterization
|
|
|
|
|
This determines if points should be rasterized as quads or points.
|
|
|
|
|
d3d always uses quad rasterization for points, regardless if point sprites
|
|
|
|
|
are enabled or not, but OGL has different rules. If point_quad_rasterization
|
|
|
|
|
is set, point_smooth should be disabled, and points will be rendered as
|
|
|
|
|
squares even if multisample is enabled.
|
|
|
|
|
sprite_coord_enable should be zero if point_quad_rasterization is not
|
|
|
|
|
enabled.
|
2010-01-06 09:42:53 -07:00
|
|
|
|
|
|
|
|
scissor
|
|
|
|
|
Whether the scissor test is enabled.
|
|
|
|
|
|
2009-12-20 17:25:36 -08:00
|
|
|
multisample
|
2010-01-18 16:40:39 -08:00
|
|
|
Whether :term:`MSAA` is enabled.
|
2010-01-06 09:42:53 -07:00
|
|
|
|
2009-12-20 17:25:36 -08:00
|
|
|
gl_rasterization_rules
|
|
|
|
|
Whether the rasterizer should use (0.5, 0.5) pixel centers. When not set,
|
|
|
|
|
the rasterizer will use (0, 0) for pixel centers.
|
2010-01-06 09:42:53 -07:00
|
|
|
|