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: glVertexPointer and glDrawArrays data transfer question

  1. #1
    Newbie Newbie
    Join Date
    Oct 2012

    glVertexPointer and glDrawArrays data transfer question

    Is it valid to update the data pointed at by the vertex pointer without updating the vertex pointer?
    That is, will I have a problem with the following pseudo code:

    glVertexPointer(4, GL_FLOAT, 1, pointer);

    pointer[0] = some new value;


    Will the updated data _always_ be transmitted or is this implementation dependent?

  2. #2
    Senior Member OpenGL Lord
    Join Date
    May 2009
    It's funny that you asked this question today, as earlier I made an edit to the Synchronization page of the Wiki addressing this very issue.

    In short, the way the *Pointer functions work when pulling from client memory is that, whenever you issue a rendering command that pulls from client memory, OpenGL must have finished reading that memory by the time the rendering command returns.

    So yes; given your code, the first rendering command will not see the changes from your "some new value" stuff, and the second rendering command will. Always.

    Incidentally, one of the reasons why the glDrawRangeElements function was so important to performance once upon a time is precisely this: it's hard to tell what range of vertex indices will be pulled when doing indexed rendering. So glDrawElements had to walk the index list to build the range. glDrawRangeElements made that unnecessary, thus making rendering faster.

    Of course, we've got buffer objects now, so it's not as important.

Posting Permissions

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