I am implementing RenderToVertexBuffer (transform feedback in opengl) support in the Ogre 3d engine.
I am now trying to take care of the output buffer binding part. That is - which elements of the vertices outputted by the vertex/geometry pipeline get written to the vertex buffer, and in what order.
I am using two sources :
1) NV_transform_feedback spec : http://www.opengl.org/registry/specs...m_feedback.txt
2) Nvidia's transform_feedback_fractal sample from http://developer.download.nvidia.com...l/samples.html .
There is a big conflict between them :
The spec states :
Two methods exist to specify which transformed vertex attributes are streamed to one, or more, buffer objects in transform feedback mode. If an OpenGL Shading Language vertex and/or geometry shader is active, then the state set with the TransformFeedbackVaryingsNV() command determines which attributes to record. If neither a vertex nor geometry shader is active, the state set with the TransformFeedbackAttribsNV() command determines which attributes to record.
However, the sample uses the glTransformFeedbackAttribsNV call to state the attributes even though it uses a geometry shader. I would say, OK, the sample is wrong, but it works!
Why is this? Am I reading the spec wrong?
The only theory that I have, is that in the spec, there is a difference between a vertex/geometry "shader" and a vertex/geometry "program". "shaders" are written in GLSL and "program" are written in assembly. Since cg (which is used in the sample) gets compiled to GL asm, it is actually a program, so glTransformFeedbackAttribsNV needs to be used instead of glTransformFeedbackVaryingsNV. Only if the shaders are written in GLSL, then is glTransformFeedbackVaryingsNV used.
Is this correct? Does anyone have any more references/samples to transform feedback that I can use?