I want to transform data from geometry shaders to feedback buffer,so I set the names of variables like this:
char *Varying[] = {"lColor","lPos","gl_NextBuffer","rColor","rPos"};
then bind two buffers vbos[2]
to transformFeedback object Tfb
,vbos[0]
to bind point 0, and vbos[1]
to bind point 2:
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 0, vbos[0]);
glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, 2, vbos[1]);
and set stream number like this:
layout(stream=0) out vec4 lColor;
layout(stream=0) out vec4 lPos;
layout(stream = 2) out rVert
{
vec4 rColor;
vec4 rPos;
};
So I thought lColor
and lPos
are transformed to vbos[0]
,rColor
and rPos
are transformed to vbos[1]
,but nothing came out,unless I change vbos[1]
to bind point 1,and stream number of rvert
to 1.
I think there is three variables about indexes for binding geometry shader output and feedback buffers,first is index
in glBindBufferBase(target,index,id)
,second is sequences of names in glTransformFeedbackVaryings(program,count,names,buffermode)
,third is stream number of variables in geometry shader,what is the relationship of these three parameters?
And I found that no matter what parameters I set the glDrawTransformFeedbackStream
,picture didn't change,Why?