Fixed-Function Vertex Post-Processing
After programmable or fixed-function vertex processing, the following fixed function
operations are applied to vertices of the resulting primitives:
- Color clamping or masking (see section 13.1).
- Transform feedback (see section 13.2).
- Primitive queries (see section 13.3).
- Flatshading (see section 13.4).
- Primitive clipping, including client-defined clip planes (see section 13.5).
- Shader output or associated data clipping (see section 13.5.1).
- Perspective division on clip coordinates (see section 13.6).
- Viewport mapping, including depth range scaling (see section 13.6.1).
- Front face determination for polygon primitives (see section 14.6.1).
- Color, texture coordinate, fog, point-size and generic attribute clipping (see section 13.5.1).
- Final color processing (see section 13.7).
Next, rasterization is performed on primitives as described in chapter 14).
_____________________________________________________________________________
13.1 Clamping or Masking
When the GL is in RGBA mode and vertex color clamping is enabled, all components
of both primary and secondary colors are clamped to the range [0; 1] after
lighting. If color clamping is disabled, the primary and secondary colors are
unmodified. Vertex color clamping is controlled by calling ClampColor, as described
in section 18.1.1, with a target of CLAMP_VERTEX_COLOR.
For a color index, the index is first converted to fixed-point with an unspecified
number of bits to the right of the binary point; the nearest fixed-point value is
selected. Then, the bits to the right of the binary point are left alone while the
integer portion is masked (bitwise ANDed) with 2n 1, where n is the number of
bits in a color in the color index buffer (buffers are discussed in chapter 9).
The state required for vertex color clamping is a three-valued integer, initially
set to TRUE.
13.2 Transform Feedback
In transform feedback mode, attributes of the vertices of transformed primitives
passed to the transform feedback stage are written out to one or more buffer objects.
The vertices are fed back after vertex color clamping, but before flatshading and
clipping. The transformed vertices may be optionally discarded after being stored
into one or more buffer objects, or they can be passed on down to the clipping stage
for further processing. The set of attributes captured is determined when a program
is linked.
The data captured in transform feedback mode depends on the active programs
on each of the shader stages. If a program is active for the geometry shader stage,
transform feedback captures the vertices of each primitive emitted by the geometry
shader. Otherwise, if a program is active for the tessellation evaluation shader
stage, transform feedback captures each primitive produced by the tessellation
primitive generator, whose vertices are processed by the tessellation evaluation
shader. Otherwise, transform feedback captures each primitive processed by the
vertex shader.
If separable program objects are in use, the set of attributes captured is taken
from the program object active on the last shader stage processing the primitives
captured by transform feedback. The set of attributes to capture in transform feedback
mode for any other program active on a previous shader stage is ignored.
13.2.1 Transform Feedback Objects
The set of buffer objects used to capture vertex output variables and related state
are stored in a transform feedback object.
- The set of attributes captured in transform feedback mode is determined using the state of the active program object.
- The name space for transform feedback objects is the unsigned integers.
- The name zero designates the default transform feedback object.
The command
- void GenTransformFeedbacks( sizei n, uint *ids );
returns n previously unused transform feedback object names in ids. These names
are marked as used, for the purposes of GenTransformFeedbacks only, but they
acquire transform feedback state only when they are first bound.
ErrorsTransform feedback objects are deleted by calling
- An INVALID_VALUE error is generated if n is negative.
ids contains n names of transform feedback objects to be deleted. After a transform
- void DeleteTransformFeedbacks( sizei n, const uint *ids );
feedback object is deleted it has no contents, and its name is again unused. Unused names in ids that have been marked as used for the purposes of GenTransformFeedbacks are marked as unused again. Unused names in ids are silently ignored, as is the value zero. The default transform feedback object cannot be deleted.
Errors
- An INVALID_VALUE error is generated if n is negative.
- An INVALID_OPERATION error is generated if the transform feedback operation for any object named by ids is currently active.
The commandreturns TRUE if id is the name of a transform feedback object. If id is zero, or
- boolean IsTransformFeedback( uint id );
a non-zero value that is not the name of a transform feedback object, IsTransformFeedback
returns FALSE. No error is generated if id is not a valid transform
feedback object name.
A transform feedback object is created by binding a name returned by Gen-
TransformFeedbacks with the commandtarget must be TRANSFORM_FEEDBACK and id is the transform feedback object
- void BindTransformFeedback( enum target, uint id );
name. The resulting transform feedback object is a new state vector, comprising
all the state and with the same initial values listed in table 23.59. Additionally, the
new object is bound to the GL state vector and is used for subsequent transform
feedback operations.
BindTransformFeedback can also be used to bind an existing transform feedback
object to the GL state for subsequent use. If the bind is successful, no change
is made to the state of the newly bound transform feedback object and any previous
binding to target is broken.
While a transform feedback buffer is bound, GL operations on the target to
which it is bound affect the bound transform feedback object, and queries of the
target to which a transform feedback object is bound return state from the bound
object. When buffer objects are bound for transform feedback, they are attached to
the currently bound transform feedback object. Buffer objects are used for transform
feedback only if they are attached to the currently bound transform feedback
object.
In the initial state, a default transform feedback object is bound and treated as13.2.2 Transform Feedback Primitive Capture
a transform feedback object with a name of zero. That object is bound any time
BindTransformFeedback is called with id of zero.
Transform feedback for the currently bound transform feedback object is started (made active) and finished (made inactive) with the commandsand
- void BeginTransformFeedback( enum primitiveMode );
- void EndTransformFeedback( void );
respectively.
- primitiveMode must be TRIANGLES, LINES, or POINTS, and specifies the output type of primitives that will be recorded into the buffer objects bound for transform feedback (see below).
- primitiveMode restricts the primitive types that may be rendered while transform feedback is active, as shown in table 13.1.
- EndTransformFeedback first performs an implicit ResumeTransformFeedback (see below) if transform feedback is paused.
- BeginTransformFeedback and EndTransformFeedback calls must be paired. Transform feedback is initially inactive.
- Transform feedback mode captures the values of output variables written by the vertex shader (or, if active, geometry shader). It may not be used during fixedfunction vertex processing.
Transform feedback operations for the currently bound transform feedback object may be paused and resumed by callingand
- void PauseTransformFeedback( void );
- void ResumeTransformFeedback( void );
respectively.
When transform feedback operations are paused, transform feedback
is still considered active and changing most transform feedback state related to the
object results in an error. However, a new transform feedback object may be bound
while transform feedback is paused.
When transform feedback is active and not paused, all geometric primitives
generated must be compatible with the value of primitiveMode passed to Begin-
TransformFeedback. An INVALID_OPERATION error is generated by any command
that transfers vertices to the GL if mode is not one of the allowed modes
in table 13.1.
If a tessellation evaluation or geometry shader is active, the type of
primitive emitted by that shader is used instead of the mode parameter passed to
drawing commands for the purposes of this error check. If tessellation evaluation
and geometry shaders are both active, the output primitive type of the geometry
shader will be used for the purposes of this error. Any primitive type may be used
while transform feedback is paused.
____________________________________________________________________
No comments:
Post a Comment