Part of the Khronos Group

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Results 1 to 4 of 4

Thread: Using Transform Feedback with glDrawElements?

  1. #1
    Junior Member Newbie
    Join Date
    Apr 2013

    Using Transform Feedback with glDrawElements?

    I want to use transform feedback to store the result of a tessellation shader. Secondly, I want to use glDrawElements, not glDrawArrays.

    However, I always get an invalid_operation error when doing the drawing call.
    I read that glDrawElements will produce this error if transform feedback is "not paused".
    Does this mean that I can't combine the two at all? What's the reason for this limitation?

    I also noticed that I can't find any examples where transform feedback is used with the GL_PATCHES mode (which is neccessary for tessellation), but I guess this is only because it's a rather new feature and probably not the reason of my error.

    Any hints appreciated.

  2. #2

  3. #3
    Junior Member Newbie
    Join Date
    Apr 2013
    I didn't want to post the full code because it's spread over several methods and classes and it would have taken a lot of time to extract the actual OpenGL calls.
    But it seems like I got it working now: I changed the mode from GL_PATCHES to GL_TRIANGLES in glBeginTransformFeedback() but still use GL_PATCHES for glDrawElements.

  4. #4
    Senior Member OpenGL Pro
    Join Date
    Apr 2010
    There is nothing special to consider when using GL_PATCHES. It's the mandatory primitive type for vertex submission commands (gl[Multi]Draw*()) when tessellation is active. BTW, a patch is not really a primitive like a triangle or a line which can actually be rasterized. It's simply an ordered list of vertices used as inputs for the tessellation control stage. The thing is, the type of primitive generated by the tessellation primitive generator is controlled by the input layout of the tessellation evaluation shader(TES)! So if you have something like this at the top of the TES

    Code :
    layout(triangles) in;

    you know that the primitive generator spits out triangles after tessellating input patches. Furthermore, you know that this is automatically the output, possibly used in subsequent geometry shading, just as if you had called glDrawElements(GL_TRIANGLES, ...) on some other data. The same goes for quads since they're simply triangulated. I'm not sure if for isolines there will be line strips or multiple lines generated. Need to review the spec here. If you simply want points (as with GL_POINTS) you need to enable the s.c. point mode

    Code :
    layout(..., point_mode) in;

Posting Permissions

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