Graphics Reference
In-Depth Information
After the transform feedback buffers are bound, we can enter and exit the
transform feedback mode using the following API calls:
void glBeginTransformFeedback (GLenum primitiveMode )
void glEndTransformFeedback ( )
primitiveMode
specifies the output type of the primitives that
will be captured into the buffer objects that
are bound for transform feedback. Transform
feedback is limited to non-indexed GL_POINTS ,
GL_LINES , and GL_TRIANGLES .
All draw calls that occur between glBeginTransformFeedback and
glEndTransformFeedback will have their vertex outputs captured into
the transform feedback buffers. Table 8-1 indicates the allowed draw mode
corresponding to the transform feedback primitive mode.
Table 8-1
Transform Feedback Primitive Mode and Allowed Draw Mode
Primitive Mode
Allowed Draw Mode
GL_POINTS
GL_POINTS
GL_LINES
GL_LINES , GL_LINE_LOOP ,
GL_LINE_STRIP
GL_TRIANGLES , GL_TRIANGLE_STRIP ,
GL_TRIANGLE_FAN
GL_TRIANGLES
We can retrieve the number of primitives that were successfully
written into the transform buffer objects using glGetQueryObjectuiv
after setting up glBeginQuery and glEndQuery with GL_TRANSFORM_
FEEDBACK_PRIMITIVES_WRITTEN . For example, to begin and end the
transform feedback mode for rendering a set of points and querying the
number of points written, the code will be as follows:
glBeginTransformFeedback ( GL_POINTS );
glBeginQuery ( GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN,
queryObject );
glDrawArrays ( GL_POINTS, 0, 10 );
glEndQuery ( GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN );
glEndTransformFeedback ( );
// query the number of primitives written
glGetQueryObjectuiv( queryObject, GL_QUERY_RESULT,
&numPoints );
 
 
Search WWH ::




Custom Search