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 3 of 3

Thread: glDrawTransformFeedback() outputs only the first captured primitive

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Junior Member Newbie Asylum's Avatar
    Join Date
    Aug 2017
    Location
    Hungary
    Posts
    9

    glDrawTransformFeedback() outputs only the first captured primitive

    I would like to make a simple demo app using transform feedback. However when I try to render the captured results (points) it outputs only the first one (of the actual 16). The TF result is generated from a single vertex with a geometry shader. I render this result with another geometry shader which creates quads from points (I will be referring to this from now on).

    • a query object verifies that the TF indeed captured 16 primitives (points)
    • f I use glDrawArrays() instead, then the vertex shader receives and outputs all 16 vertices, but the geometry shader uses only the first (and outputs the same quad 16 times)
    • the geometry shader is pretty simple, and it works fine, so I don't think that's the issue


    Images from RenderDoc:

    glDrawTransformFeedback: https://www.dropbox.com/s/qyst1ktkfomi649/dtf.png?dl=0
    glDrawArrays: https://www.dropbox.com/s/gzznvgkctotg4s9/darr.png?dl=0

    Relevant code: https://www.dropbox.com/s/8crnopeyjwrxnb7/main.cpp?dl=0

    What might cause this behavior?
    Last edited by Asylum; 09-26-2017 at 08:51 AM.

  2. #2
    Junior Member Newbie Asylum's Avatar
    Join Date
    Aug 2017
    Location
    Hungary
    Posts
    9
    Solved...apparently it is not a wise idea to put user-defined outputs/inputs into gl_PerVertex (or perhaps any) interface block. After rewriting the shaders like:

    Code :
    out int vs_particleType;
    out vec3 vs_particlePosition;
    out vec3 vs_particleVelocity;
    out float vs_particleAge;
    out uint vs_particleColor;

    etc. the program works as expected.

  3. #3
    Senior Member OpenGL Lord
    Join Date
    May 2009
    Posts
    5,932
    Quote Originally Posted by Asylum View Post
    Solved...apparently it is not a wise idea to put user-defined outputs/inputs into gl_PerVertex
    It's not a question of being a "wise idea"; it's not allowed. Your shader should have failed to compiled; the specification is very clear on this. When you redeclare `gl_PerVertex`, you can only insert the members that are predefined.

Tags for this Thread

Posting Permissions

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