Jump to content
  • Advertisement
Sign in to follow this  
Geometrian

OpenGL Transform Feedback

This topic is 2679 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,

Working on a GPU particles implementation using the transform feedback buffer. The "Transform Feedback Fractal" code sample here 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: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);
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
Advertisement
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!