Part of the Khronos Group
OpenGL.org

The Industry's Foundation for High Performance Graphics

from games to virtual reality, mobile phones to supercomputers

Page 2 of 2 FirstFirst 12
Results 11 to 11 of 11

Thread: Custom Vertex Attributes

  1. #11
    Member Regular Contributor
    Join Date
    May 2016
    Posts
    445
    Quote Originally Posted by CaptainSnugglebottom View Post
    Code :
    LOOP FOR EACH OBJECT:
    glBufferSubData(GL_ARRAY_BUFFER​, sizeof(arrayBufferStuff)*objectIndex​, sizeof(arrayBufferStuff)​, &arrayBufferStuff);
    glBufferSubData(GL_SHADER_STORAGE_BUFFER, sizeof(ssBufferStuff)*objectIndex​, sizeof(ssBufferStuff)*objectIndex​, &ssBufferStuff);

    ... or should I buffer the data as C++ arrays first, before writing sending them to GPU in one go?
    the first suggestion uses OBJECT_COUNT x glBufferSubData, the latter just 1 x glBufferSubData function call(s), therefore put the data first into a c++ vector before uploading it. and have a look at how you have to pad the shader storage buffer data (std430): https://www.khronos.org/registry/Ope...e.pdf#page=159

    have a look at the DSA version glNamedBufferSubData(...) too, or glMapNamedBuffer(...), or a persistent mapped buffer with glMapNamedBufferRange(...)
    Last edited by john_connor; 11-18-2017 at 03: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
  •