i've done some research on streaming vertices, , i've found 4 ways upload asynchronously (i think).
orphaning approaches:
before every write, create new storage buffer glbufferdata, efficient write glmapbuffer /glunmapbuffer
before write glmapbuffer, use the
gl_map_invalidate_buffer_bit flag indicate implementation may create new storage. in practice, same thing as
orphaning glbufferdata
other approaches:
use gl_map_unsynchronized_bit glmapbuffer force asynchronous writes same buffer gpu may reading from. promise not write @ same location reads happening or undefined behaviour. guess way use alternating writing 1 side of buffer, , having gpu read side thats not being written to.
use double buffering: create 2 vbos. alternate 1 written
, 1 read from. use glmapbuffer read / write from
them efficiently. bind correct vbo vao drawing each time. should asynchronous.
please tell me if said wrong.
i'd know, advisable use. care performance. orphaning approaches seem expensive because allocations / deallocations. double buffering seems best because wont have allocation costs (right?) , it's not complicated third approach.
Comments
Post a Comment