Transform Feedback with a VAO and a GS
Hello, I'm studying modern OpenGL for a project (I always used ancient immediate mode when I needed it) and one of my task is to manage some particle emitters.
I discovered about Transform Feedback and the process seems quite clear but I have two doubts to specific questions: can I attach a geometry shader AFTER the transform feedback phase (and just when rasterizing). I ask this because it seemed efficient to have points which are moved and managed by the TF, these points then become quads thanks to a shader so that I can apply a texture to them. I know about point sprites but they seem some what limited so I would like to avoid them.
The second question is related to using the transform feedback with a vertex array object: is there any limitation or drawback in using a VAO in this context?
Thanks in advance!
Note: forgot to mention, since I'm currently working on OS X my target is core 3.2 until 10.9 ships
1) TF always occurs from the last shader present prior to the fragment shader. So if you have a geometry shader in the linked program, no, you can't TF from the vertex shader. You could have two programs, one using TF from the vertex shader with rasterize discard, and a second one using the geometry shader and rasterizing, but you will pay the cost of two draws (and at least a pass-through dummy vertex shader in the second program.) In more modern GL (4.2+) you'd have additional options of directly writing to images or buffers from the vertex stage.
2) You're always using a VAO. In GL2 / Compatibility profile, you're using VAO #0 if you don't make your own. In GL3.2 / Core, you have to make your own. So, no, there are no limitations. You might also want to look at using a TFO, to manage the set of bound TF buffers, but that's in ARB_transform_feedback2, or GL4.0+.
Thanks, this means that I will have to create particles directly as GL_TRIANGLE_STRIP and skip the geometry shader, it seems the more reasonable way for my current knowledge.
It seems like that the simpler solution would be to have a simple VAO and update the logic on CPU while sending updated buffers to the GPU at each frame (this is how I'm used to do so far) but this transform feedback solution seems suitable, the only problem is that it requires more foundations