PS: This is not a real PR, it's just an example. I didn't even try to compile it. I'm not actually using the library.
The attribute state is not being saved and restored. And even this is not actually 100%. To be 100% you'd need to check for the ANGLE_instanced_arrays extension and if it exists, enable it and save and restore the divisor as in
// save
if (extension)
last_attr0_divisor = gl.getVertexAttrib(attriblocation, extension.VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE);
// restore
if (extension) {
extension.vertexAttribDivisorANGLE(attriblocation, last_attr0_divisor);
And worse, this only handles WebGL1. In WebGL2 you'd arguably want to skip all the code in the PR, make a vertex array, save the current one, bind yours, then restore
See issue #40
PS: This is not a real PR, it's just an example. I didn't even try to compile it. I'm not actually using the library.
The attribute state is not being saved and restored. And even this is not actually 100%. To be 100% you'd need to check for the
ANGLE_instanced_arrays
extension and if it exists, enable it and save and restore the divisor as inAnd worse, this only handles WebGL1. In WebGL2 you'd arguably want to skip all the code in the PR, make a vertex array, save the current one, bind yours, then restore