Graphics Reference
In-Depth Information
useful for a wide range of techniques that perform animation on the GPU
without any CPU intervention, such as particle animation or physics
simulation using render-to-vertex-buffer.
To specify the set of vertex attributes to be captured during the transform
feedback mode, use the following command:
void glTransformFeedbackVaryings (GLuint program,
GLsizei count,
const char** varyings,
GLenum bufferMode )
program
specifies the handle to the program object.
count
specifies the number of vertex output variables used for
transform feedback.
varyings
specifies an array of count zero-terminated strings
specifying the names of the vertex output variables to
use for transform feedback.
bufferMode
specifies the mode used to capture the vertex output
variables when transform feedback is active.
Valid values are GL_INTERLEAVED_ATTRIBS , to capture
the vertex output variables into a single buffer, and
GL_SEPARATE_ATTRIBS , to capture each vertex output
variable into its own buffer.
After calling glTransformFeedbackVaryings , it is necessary to link the
program object using glLinkProgram . For example, to specify two vertex
attributes to be captured into one transform feedback buffer, the code will
be as follows:
const char* varyings[] = { "v_position", "v_color" };
glTransformFeedbackVarying ( programObject, 2, varyings,
GL_INTERLEAVED_ATTRIBS );
glLinkProgram ( programObject );
Then, we need to bind one or more buffer objects as the transform
feedback buffers using glBindBuffer with GL_TRANSFORM_FEED-
BACK_BUFFER . The buffer is allocated using glBufferData with
GL_TRANSFORM_FEEDBACK_BUFFER and bound to the indexed binding
points using glBindBufferBase or glBindBufferRange . These buffer
APIs are described in more details in Chapter 6, “Vertex Attributes, Vertex
Arrays, and Buffer Objects.”
 
 
Search WWH ::




Custom Search