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

Thread: glDrawElementsIndirect() with ELEMENT_ARRAY_BUFFER offset ??

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Senior Member OpenGL Guru Dark Photon's Avatar
    Join Date
    Oct 2004

    glDrawElementsIndirect() with ELEMENT_ARRAY_BUFFER offset ??

    As we all know, when ripping batches with standard glDrawElements() or glDrawElementsInstanced(), with a standard VBO bound with glBindBuffer( GL_ELEMENT_ARRAY_BUFFER ) containing the index list, you can provide a byte-offset into this VBO via the "const void *indices" argument to these draw calls. This allows you to place the index list for a batch anywhere within the bound buffer.

    However, when using glDrawElementsIndirect() or glMultiDrawElementsIndirect(), there is no such argument to provide a byte-offset into the GL_ELEMENT_ARRAY_BUFFER. So, logically, one would think you should just account for the byte offset by binding it, not with ol' glBindBuffer(), but with glBindBufferRange instead, providing the byte offset into the buffer to the "offset" parameter of this API call...

    ...except that glBindBufferRange does not accept GL_ELEMENT_ARRAY_BUFFER as a valid buffer target. (???)

    How do you do this? Am I missing something?

    That is, how do you provide a byte-offset into a buffer object to use for fetching the index list in a glDrawElementsIndirect() call? an aside, it's interesting to note that if you use NV bindless with glDrawElementsIndirect() or glMultiDrawElementsIndirect(), it doesn't appear that you have any problem with byte offsets into the index buffer, as you'd provide the byte offset into the glBufferAddressRangeNV() call as usual before launching the draw call:

    Code cpp:
    glBufferAddressRangeNV( GL_ELEMENT_ARRAY_ADDRESS_NV, 0, gpu_addr+offset, size );
    Last edited by Dark Photon; 02-12-2013 at 05:49 PM.

Posting Permissions

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