Search code examples
openglglslgpgputransform-feedback

TransformFeedback binding multiple output buffers


I'm using the TransformFeedback feature of GL. Is it possible to bind multiple output buffers instead of a single buffer? Assuming I have two output varyings:

out vec4 out0;
out vec4 out1;

And I have generated two buffer objects for them:

glGenBuffers(1, &id0);
glGenBuffers(1, &id1);

How can I bind id0 to out0 and id1 to out1?

I've tried the glBindBuffersBase and glBindBufferRange, but seems neither does this.


Solution

  • Use GL_SEPARATE_ATTRIBS as the bufferMode parameter for glTransformFeedbackVaryings, and you'll get one buffer bind point per output. However, note there is a maximum number of transform feedback buffers, so this isn't always going to work if you want to capture lots of outputs concurrently.

    Once you've done that then you'll need to bind one buffer GL_TRANSFORM_FEEDBACK_BUFFER per transform feedback location.