Respect buffer's original dimension when updating reglBuffer data#669
Respect buffer's original dimension when updating reglBuffer data#669fuzhenn wants to merge 1 commit intoregl-project:mainfrom
Conversation
|
Sorry this has sat for a long time, but it's my opinion that perhaps the current behavior is correct. The docs say:
In that sense, I believe it's a full reinitialization with interpretation of arguments identical to the initial creation of the buffer, so that if you had to specify a dimension during initial creation, you should have to specify it during reinitialization as well. Assuming some existing buffer, you can achieve the correct dimension by either specifying the dimension explicitly, e.g. existingBuffer({
data: [1, 2, 3],
dimension: 3
})or you can nest the data as an array of arrays, e.g. existingBuffer([[1, 2, 3]])If you want to replace data in-place without reinitializing, If this is still of interest, let me know if you have opinions. Thanks! |
Currently, buffer's dimension will be always reset to 1 when calling buffer(array) to update its data.
This default behavior will lead to some incorrect context, e.g. wrong size parameter when calling gl.vertexAttribPointer in REGLVAO.
Respect buffer's original dimension will solve it.