How to make transform feed back work?

Following code is my try to get transform feed back from OpenGL , but I can’t start the feed back at line A. What I’ve missed ? many thanks!

GLuint feed,buf;
// create the feed back object
glGenTransformFeedbacks(1,&feed);
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK,feed);
// create the buffer object
glGenBuffers(1,&buf);
glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER,buf); 
// make sure the buffer has non-zero size 
unsigned char data[200] = {0};
glBufferData(GL_TRANSFORM_FEEDBACK_BUFFER,200,(void*)data,GL_STATIC_READ);
// bind
glTransformFeedbackBufferBase(feed,0,buf);
// start
glBeginTransformFeedback(GL_TRIANGLES);  // A

You didn’t show how you’re designating which varyings to capture to which buffers and to which offsets. There are multiple ways to do this. You should post what you’re doing:

thank you. that is to say it is impossible to transform feed back without using a geometry shader?

No, you don’t need a geometry shader.

You may be misinterpreting this statement in the Wiki:

Output variables in the Geometry Shader can be declared to go to a particular stream.

Having separate streams of vertex data routed to different feedback buffers is a feature specifically of geometry shaders. However, that’s not just transform feedback; that’s a particular kind of feedback operation which involves multiple streams of output vertices. That specific TF operation requires a GS, but most of TF has no special relationship to using a GS.

This topic was automatically closed 183 days after the last reply. New replies are no longer allowed.