jfcameron / gdk-graphics

3D Rendering using OpenGLES 2.0/WebGL1.0. Platforms: Linux, Windows, Mac, x86 64bit, arm64, wasm
MIT License
1 stars 1 forks source link

webgl1es2_model::update_vertex_data: support glBufferSubData #59

Open jfcameron opened 3 years ago

jfcameron commented 3 years ago

currently there is only one version of update_vertex_data, which completely rewrites the buffer.

provide an overload that takes new data and overwrites existing data in the existing buffer. void ewbgl1es2_model::update_vertex_data(data, index)?

q: what should the behaviour be if the new data requries a resize? model does not keep around a copy of its vertex data, so i cannot resize. therfore update_vertex_data cannot be completed. it should throw an invalid_arg OR update_vertex_data should be renamed try_update_vertex_data and should return a bool. Im going to go with the throw first, i think its reasonable to expect the user to keep track of this data.

q: in the existing overload, do I check if the upload failed? that should be done. if it fails it should throw.

jfcameron commented 3 years ago

bump. need this for uv animations done on cpu side. doing this in shader requires additional vertex data. both have their uses.