Results 1 to 2 of 2

Thread: glVertexPointer and glDrawArrays data transfer question

  1. #1
    Newbie Newbie
    Join Date
    Oct 2012
    Posts
    1

    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);
    glDrawArrays(...);

    pointer[0] = some new value;

    glDrawArrays(...)

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

  2. #2
    Senior Member OpenGL Lord
    Join Date
    Mar 2015
    Posts
    6,674
    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.

Similar Threads

  1. Transfer data CPU -> GPU
    By EugChriss in forum Vulkan
    Replies: 2
    Last Post: 01-22-2018, 07:20 AM
  2. VBO to VBO data transfer
    By Aleksandar in forum OpenGL: Advanced Coding
    Replies: 7
    Last Post: 10-02-2009, 11:01 AM
  3. glVertexPointer() & glDrawArrays() algorithms
    By m7acx in forum OpenGL: General
    Replies: 12
    Last Post: 03-23-2008, 02:24 PM
  4. glVertexPointer, glDrawArrays?
    By shellee in forum OpenGL ES
    Replies: 2
    Last Post: 11-03-2004, 03:05 PM
  5. Quick question on data transfer
    By Freelancer in forum OpenGL: Advanced Coding
    Replies: 2
    Last Post: 02-10-2004, 08:42 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Proudly hosted by Digital Ocean