Skip to content

Commit

Permalink
fix VAO force disable
Browse files Browse the repository at this point in the history
  • Loading branch information
bcamper committed Feb 24, 2019
1 parent 933fdfa commit f4235db
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/gl/vao.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,18 @@ export default {
}
},

getExtension(gl, ext_name) {
if (this.disabled !== true) {
return getExtension(gl, ext_name);
}
},

create (gl, setup, teardown) {
let vao = {};
vao.setup = setup;
vao.teardown = teardown;

let ext = getExtension(gl, 'OES_vertex_array_object');
let ext = this.getExtension(gl, 'OES_vertex_array_object');
if (ext != null) {
vao._vao = ext.createVertexArrayOES();
ext.bindVertexArrayOES(vao._vao);
Expand Down Expand Up @@ -58,7 +64,7 @@ export default {
},

bind (gl, vao) {
let ext = getExtension(gl, 'OES_vertex_array_object');
let ext = this.getExtension(gl, 'OES_vertex_array_object');
if (vao != null) {
if (ext != null && vao._vao != null) {
ext.bindVertexArrayOES(vao._vao);
Expand All @@ -81,7 +87,7 @@ export default {
},

destroy (gl, vao) {
let ext = getExtension(gl, 'OES_vertex_array_object');
let ext = this.getExtension(gl, 'OES_vertex_array_object');
if (ext != null && vao != null && vao._vao != null) {
ext.deleteVertexArrayOES(vao._vao);
vao._vao = null;
Expand Down

0 comments on commit f4235db

Please sign in to comment.