Sign in to follow this  
Geometrian

OpenGL Transform Feedback

Recommended Posts

Hi,

Working on a GPU particles implementation using the transform feedback buffer. The "Transform Feedback Fractal" code sample [url="http://developer.download.nvidia.com/SDK/10/opengl/samples.html"]here[/url] runs as expected, and my code is based off of it.


In truth, I really don't know what I'm doing. Here's my code that's supposed to update the particles:[code]GLuint query = 1;

glBindBufferOffsetEXT(GL_TRANSFORM_FEEDBACK_BUFFER_EXT, 0, _vbo_position, 0);

glBeginTransformFeedbackEXT(GL_POINTS);
glEnable(GL_RASTERIZER_DISCARD_EXT);
glBeginQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT, query);


glEnableClientState(GL_VERTEX_ARRAY);

glBindBuffer(GL_ARRAY_BUFFER,_vbo_position);
glVertexPointer(3,GL_FLOAT,0,NULL);

glLibUseShader(shader_update);
glDrawArrays(GL_POINTS,0,numof_particles);
glLibUseShader(NULL);

glDisableClientState(GL_VERTEX_ARRAY);


glEndQuery(GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN_EXT);
glDisable(GL_RASTERIZER_DISCARD_EXT);
glEndTransformFeedbackEXT();

GLuint primitives_written;
glGetQueryObjectuiv(query, GL_QUERY_RESULT, &primitives_written);
printf("Wrote: %d primitives!\n",primitives_written);[/code]The last line always prints 0.

numof_particles is nonzero.

I've checked the shader; it compiled correctly. The vertex program simply transforms the vertex according to the standard pipeline, and then adds a constant vector (in the future, it will add velocity instead). There is no geometry or fragment program.

Help? Thanks!
-G

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this