Transform Feedback and Instanced Arrays

Hi,

I’m trying to create square particles using instances.
I have a VBO with the position of each instance (not for each vertex). I’m using glVertexAttribDivisor for this purpose.
My VBO has a size of : 3 * sizeof(GLfloat) * number_of_particles.

Now, Transform Feedback will give me 1 position for each vertex which give me a VBO with a size 4 times bigger that what I need.

So, I was wondering if there is something to do about that.

Thanks.

Now, Transform Feedback will give me 1 position for each vertex which give me a VBO with a size 4 times bigger that what I need.

Um… why? If you write one float from your TF operation, then you get one float written. So how is it “4 times bigger”?

Because, the way I’m understanding TF is that it will give me one value per vertex (one value each time vertex shader is called).
But I only want one value per instance (each 4 vertices).
Maybe I’m wrong.

[QUOTE=LudovicN;1291357]Because, the way I’m understanding TF is that it will give me one value per vertex (one value each time vertex shader is called).
But I only want one value per instance (each 4 vertices).[/quote]

I’m not understanding the purpose of transform feedback in your use case. I assumed you were performing feedback in order to compute the “one value per instance” that you would use later for rendering. So what exactly is the purpose of the feedback operation.

If you’re rendering a particle system, what exactly do you need feedback for during the particle rendering process?

I want to use it to update the next position of each particle in the vbo on the gpu side.
Actually, I’m doing it while drawing.
I think that is the problem. I should probably create a separate shader to update the positions and use TF with it.