Sweet!
But doing tests only works for the stream 0, would you tell me what would be the logic for N streams? (now I was trying to capture 2 streams in to 2 querys objects)
It’s just a small variation on the same theme.
If you’re writing to multiple streams with TF, you can query the GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN counts separately for each stream by having an active query object per stream. Start/stop the queries with glBeginQueryIndexed and glEndQueryIndexed. Then query the result as usual:
// Generate queries to determine how many entries written
GLuint outquery[ TF_NUM_OUT ];
glGenQueries( TF_NUM_OUT, outquery );
for ( int i = 0; i < TF_NUM_OUT; i++ )
glBeginQueryIndexed( GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, i, outquery[i] );
// --- EXECUTE TRANSFORM FEEDBACK RUN WRITING TO MULTIPLE STREAMS HERE ---
// Query/print how many entries written
GLint counts[ TF_NUM_OUT ];
for ( int i = 0; i < TF_NUM_OUT; i++ )
{
glEndQueryIndexed ( GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, i );
glGetQueryObjectiv( outquery[i], GL_QUERY_RESULT, &counts[i] );
printf( "Num primitives written for output %d = %d
", i, counts[i] );
}
glDeleteQueries( TF_NUM_OUT, outquery );
This is copy/paste from some old standalone example code I whipped up years ago which reads back the primitives written to the CPU in a counts array.
To change this to use ARB_query_buffer_object, just make the trivial change to bind the drawIndirectBuffer to GL_QUERY_BUFFER before calling glGetQueryObjectuiv to fetch the result into the specified offset of the bound buffer, rather than calling glGetQueryObjectiv as I do here to query the result into a CPU-side counts array.
This same code was in the example source:
[ul]
[li]Re: Still having problems with calling glTransformFeedbackVaryings[/li][/ul]
I pointed you to above by the way.