summaryrefslogtreecommitdiffstats
path: root/o3d/samples/o3d-webgl/primitive.js
diff options
context:
space:
mode:
Diffstat (limited to 'o3d/samples/o3d-webgl/primitive.js')
-rw-r--r--o3d/samples/o3d-webgl/primitive.js16
1 files changed, 11 insertions, 5 deletions
diff --git a/o3d/samples/o3d-webgl/primitive.js b/o3d/samples/o3d-webgl/primitive.js
index 4c74c69..5e8bcf3 100644
--- a/o3d/samples/o3d-webgl/primitive.js
+++ b/o3d/samples/o3d-webgl/primitive.js
@@ -178,11 +178,17 @@ o3d.Primitive.prototype.render = function() {
break;
}
- this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, indexBuffer.gl_buffer_);
- this.gl.drawElements(glMode,
- glNumElements,
- this.gl.UNSIGNED_SHORT,
- 0);
+ if (!indexBuffer) {
+ this.gl.drawArrays(glMode,
+ 0,
+ glNumElements);
+ } else {
+ this.gl.bindBuffer(this.gl.ELEMENT_ARRAY_BUFFER, indexBuffer.gl_buffer_);
+ this.gl.drawElements(glMode,
+ glNumElements,
+ this.gl.UNSIGNED_SHORT,
+ 0);
+ }
for (var i = 0; i < enabled_attribs.length; ++i) {
this.gl.disableVertexAttribArray(enabled_attribs[i]);