Skip to content

Commit 1d5e1f7

Browse files
committed
Skip drawing zero-length VAOs, fixes "Render count or primcount is 0."
Chrome now warns when drawing zero-length: 16localhost/:1 [.CommandBufferContext]RENDER WARNING: Render count or primcount is 0. Closes voxel/voxelmetaverse#109
1 parent 86c3874 commit 1d5e1f7

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

aoshader.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ ShaderPlugin.prototype.render = function() {
106106
var mesh = this.meshes[chunkIndex]
107107

108108
var triangleVAO = mesh.vertexArrayObjects.surface
109-
if (triangleVAO) { // if there are triangles to render
109+
if (triangleVAO && triangleVAO.length !== 0) { // if there are triangles to render
110110
shader.uniforms.model = mesh.modelMatrix
111111
triangleVAO.bind()
112112
gl.drawArrays(gl.TRIANGLES, 0, triangleVAO.length)
@@ -129,7 +129,7 @@ ShaderPlugin.prototype.render = function() {
129129
var mesh = this.meshes[chunkIndex]
130130

131131
var blockMesh = mesh.vertexArrayObjects.porous
132-
if (blockMesh) {
132+
if (blockMesh && blockMesh.length !== 0) {
133133
shader2.uniforms.model = this.meshes[chunkIndex].modelMatrix
134134

135135
blockMesh.bind()

0 commit comments

Comments
 (0)