blackHolesBuf = []; BlackHole = function(center, size) { if (blackHolesBuf.length == BLACKHOLE_MAX_COUNT) throw "Error: cannot add more black holes, limit of " + BLACKHOLE_MAX_COUNT + " reached!" this.rs = size / 3; this.index = blackHolesBuf.push([]) - 1; this.moveTo(center); } BlackHole.prototype.moveTo = function(newCenter) { blackHolesBuf[this.index] = newCenter.concat(this.rs); gl.uniform4fv(gl.getUniformLocation(glprog, "uBH[" + this.index + "]"), blackHolesBuf[this.index]); } BlackHole.prototype.draw = function() { // Black holes are not "drawn" }