Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p><strong>Short answer:</strong></p> <p>Use <em>glMapBufferRange</em> and only update the subrange that needs modification.</p> <p><strong>Long answer:</strong></p> <p>The trick is to map the already existing buffer with <em>glMapBufferRange</em>, and then only map the range you need. Given these assumptions:</p> <ul> <li>Your geometry uses per-vertex animation morphing</li> <li>The vertex count for models is constant during animation.</li> </ul> <p>Then you can use <em>glMapBufferRange</em> to update only the changing parts, and leave the rest of the data alone. Full uploads using <em>glBufferData</em> are slow as a turtle, because they delete the old memory store and allocates a new one. That's in addition to uploading the new data. <em>glMapBufferRange</em> only lets you read/write existing data, it does no allocation or deallocation.</p> <p>However, if you use skeleton animation, rather pass vertex transformations as 4x4 matrices per-vertex to the vertex shader, and do the calculations there. Per-vertex data is of course specified with <em>glVertexAttribPointer</em>.</p> <p>Also, remember that you can read texture data in the vertex shader, and that OpenGL 3.1 introduced some new instance draw calls; <em>glDrawArraysInstanced</em> and <em>glDrawElementsInstanced</em>. Those combined can be used for instance-specific lookups. I.e you can do instance draw calls with the same geometry data bound, but send positions or whatever per-vertex data you need as textures or texture-arrays. This can save you from mixing and matching different vertex array data sets.</p> <p>Imagine if you want to render 100 instances of the same model, but with different positions or color schemes. Or even texture maps.</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload