Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 5 of 5

Thread: Transform Feedback and Instanced Arrays

  1. #1
    Junior Member Newbie
    Join Date
    May 2018
    Posts
    3

    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.

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,003
    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"?

  3. #3
    Junior Member Newbie
    Join Date
    May 2018
    Posts
    3
    Quote Originally Posted by Alfonse Reinheart View Post
    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.

  4. #4
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    6,003
    Quote Originally Posted by LudovicN View Post
    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).
    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?

  5. #5
    Junior Member Newbie
    Join Date
    May 2018
    Posts
    3
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •