Well check the spec, but IIRC the way it works is (considering only 1 output stream): SEPARATE writes each TF output to its own separate buffer bind point, whereas INTERLEAVED interleaves them all into the same buffer (bound to a single buffer bind point). That’s for a single output stream. With multiple output streams, you have more flexibility and can interleave the outputs written to a each stream in their own buffer, but you still have each separate stream filling its own output buffer. So the buffer for each stream is bound to its own indexed buffer bind point (using glBindBufferBase or glBindBufferRange).
For reference, see Transform Feedback in the wiki. In particular, the Advanced Interleaving section.
Also check the OpenGL Spec. In particular, pg. 449 where it’s talking about when a program can fail to link due to a call to glTransformFeedbackVaryings(), it says one way this can happen is if: “the set of outputs to capture to any single binding point includes outputs from more than one vertex stream.” So your streams will be routed to the buffers bound to separate binding points, one per stream.
When I create the transform feedback object that first that I made is bind him with a GL_ARRAY_BUFFER with a maximum size equivalent to all the information that may contain, leaving it empty, This is Right?
If you’re talking about the buffer object which will contain the TF output, yes. You just need to allocate it (glBufferData). You don’t care what it contains as it’ll be overwritten.
- I must use glBindBufferBase() for set each Stream in to a unique Buffer? I do not need to indicate how much space has each one?
Or glBindBufferRange(), yes. See Buffer Binding on the Transform Feedback wiki page.
glBindBufferBase() binds the whole buffer, however big it is, for TF output. It is expected that you’ve already allocated storage to it (e.g. by calling glBufferData with it bound to a buffer bind point.
2 This includes using glMultiDrawElementsIndirectCount() from ARB_indirect_parameters?, when you says “(on top of the “instanceCount” members) in the indirect draw call buffer(s)” this means that I have to bind GL_INDIRECT_BUFFER with Tranform Feedback Object too?
I don’t understand what you’re asking here.
Separate in your mind what’s required for the transform feedback pass, and then what’s required for issuing an indirect draw call. You run TF first. That gives you a list of instances in each stream, and a number of instances written to each stream. …THEN… You’re going to issue an indirect draw call (or calls) that actually tell the GPU to draw with those instance lists.
All I was trying to say is it’s up to you how you communicate the number of instances written to a stream from the TF output pass -TO- the draw call parameters used by the indirect draw call. There are several possible ways. It’s up to you which way you go!
- How I can made the output counts on geometry step to use with GL_INDIRECT_BUFFER?
Don’t think in terms of buffer binding points. Those are just like hooks that you can hang buffer objects on if/when needed. Think in terms of your buffer objects and the contents that they have.
The buffer object bound to the GL_INDIRECT_BUFFER contains draw call parameters. These are the same parameters you’d provide in your CPU function call to a non-indirect draw call like (for instance) glDrawArraysInstanced(). To see exactly what the format is for glDrawArraysIndirect(), see the man page and look at the DrawArraysIndirectCommand struct. See the “primCount” member? That’s the number of instances. You need to use some method (such as one of those described above) to copy the number of instances written to a stream in the TF output pass into that “primCount” member. Once you get it in there, then you can bind that buffer object to the GL_INDIRECT_BUFFER and issue your indirect draw call. Does that make sense?
- I can´t find examples codes / or exercises from 4.4Core about Transform Feedback, as a way to learn, would it be possible share some code that you have?
I don’t have time to look through a lot of code, but if you post code snippets here with specific questions, I’m sure folks here will be able to help you clear up any confusion you might have. Before you do though, I would definitely read that Transform Feedback wiki page as well as the wiki section on Indirect rendering. If something is confusing, just ask!