Wednesday, April 6, 2011

ARB_transform_feedback2

I could not find enough demos on how to use the new ARB transform feedback2 extension. Basically it goes like this,
1) You need to call
 
glGenTransformFeedbacks(1, &tfID);
glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, tfID);

like any other function in OpenGL.

2) You specify the buffer and the shader varyings.
 
glBindBufferBase( GL_TRANSFORM_FEEDBACK_BUFFER, 0, tfvbo ); glTransformFeedbackVaryings( pg, 1, attr, GL_INTERLEAVED_ATTRIBS); //(my cards does not support the EXT function


3) In the render function u don’t call glDraw[*] functions instead u call
 
glDrawTransformFeedback(GL_POINTS, tfID);

The buffer binding is taken from the tfID transform feedback buffer.
Thats it. The new way simplifies the handling of buffers.
Attached is the full source code.

Source Code
Binary (Requires freeglut and glew)
Visual Studio 2008 sln (Requires freeglut and glew)

Download solution from Google Docs

0 comments:

Popular Posts

Copyright (C) 2011 - Movania Muhammad Mobeen. Awesome Inc. theme. Powered by Blogger.