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

Thread: Element buffer offset?

  1. #1
    Junior Member Regular Contributor Zulfiqar Malik's Avatar
    Join Date
    Jun 2004
    London, UK

    Element buffer offset?

    Ok, the problem is that, in case of using regular index buffers you can specify offset to the start of an index buffer (in case you have multiple index buffers packed together in a single array) by simply giving offset from the base pointer like ...

    glDrawElements(..., ..., (basePointer + offset));

    However, i can't figure out how to specify offset in case of hardware accelerated element buffers. I have tried giving offset as an integer, something similar to specifying offset in glVertexPointer(...) while using VBOs. I have even played around with glDrawRangeElements(...) by specifying offset in the "start" parameter (2nd parameter if i remember correctly) and also in the last parameter. Nothing seems to be working. I am sure you can do it in GL similar to DrawIndexedPrimitive(...) in DX. I hope its not a driver issue. I have tested it on two different NV3x video cards with the latest certified drivers.

    Thanks in advance.
    Zulfiqar Inayat Malik.
    Senior Developer, The Foundry.

  2. #2
    Senior Member OpenGL Pro
    Join Date
    May 2001
    The Round Table at Camelot

    Re: Element buffer offset?

    Here is how I do it:

    char *indPtr = (char*)0 + ( indexStart * sizeof( indexType ) );

    So if you have your indices as integers, sizeof( indexType ) will be sizeof(int).

    And indPtr is put in the last parameter of glDrawElements for example.


Posting Permissions

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