Merge pull request #38 from elemoine/webgl-point-uint
Fix assert in WebGL replay
This commit is contained in:
@@ -434,17 +434,19 @@ ol.render.webgl.ImageReplay.prototype.finish = function(context) {
|
|||||||
|
|
||||||
this.indicesBuffer_ = gl.createBuffer();
|
this.indicesBuffer_ = gl.createBuffer();
|
||||||
gl.bindBuffer(goog.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_);
|
gl.bindBuffer(goog.webgl.ELEMENT_ARRAY_BUFFER, this.indicesBuffer_);
|
||||||
|
var indices = this.indices_;
|
||||||
var /** @type {ArrayBufferView} */ arrayBuffer, bits;
|
var /** @type {ArrayBufferView} */ arrayBuffer, bits;
|
||||||
if (context.hasOESElementIndexUint) {
|
if (context.hasOESElementIndexUint) {
|
||||||
bits = 32;
|
bits = 32;
|
||||||
arrayBuffer = new Uint32Array(this.indices_);
|
arrayBuffer = new Uint32Array(indices);
|
||||||
} else {
|
} else {
|
||||||
bits = 16;
|
bits = 16;
|
||||||
arrayBuffer = new Uint16Array(this.indices_);
|
arrayBuffer = new Uint16Array(indices);
|
||||||
}
|
}
|
||||||
goog.asserts.assert(this.indices_[this.indices_.length - 1] < (1 << bits),
|
goog.asserts.assert(indices[indices.length - 1] < Math.pow(2, bits),
|
||||||
'Too large element index detected, and OES_element_index_uint ' +
|
'Too large element index detected [%s] (OES_element_index_uint "%s")',
|
||||||
'extension not available.');
|
indices[indices.length - 1], context.hasOESElementIndexUint);
|
||||||
|
|
||||||
gl.bufferData(goog.webgl.ELEMENT_ARRAY_BUFFER, arrayBuffer,
|
gl.bufferData(goog.webgl.ELEMENT_ARRAY_BUFFER, arrayBuffer,
|
||||||
goog.webgl.STATIC_DRAW);
|
goog.webgl.STATIC_DRAW);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user