diff --git a/src/data/program_configuration.js b/src/data/program_configuration.js index 9e0d9e0512d..bb3eb38ae7e 100644 --- a/src/data/program_configuration.js +++ b/src/data/program_configuration.js @@ -185,7 +185,11 @@ class SourceExpressionBinder implements Binder { upload(context: Context) { if (this.paintVertexArray && this.paintVertexArray.arrayBuffer) { - this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent); + if (this.paintVertexBuffer && this.paintVertexBuffer.buffer) { + this.paintVertexBuffer.updateData(this.paintVertexArray); + } else { + this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent); + } } } @@ -280,7 +284,11 @@ class CompositeExpressionBinder implements Binder { upload(context: Context) { if (this.paintVertexArray && this.paintVertexArray.arrayBuffer) { - this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent); + if (this.paintVertexBuffer && this.paintVertexBuffer.buffer) { + this.paintVertexBuffer.updateData(this.paintVertexArray); + } else { + this.paintVertexBuffer = context.createVertexBuffer(this.paintVertexArray, this.paintVertexAttributes, this.expression.isStateDependent); + } } }