diff options
-rw-r--r-- | src/webGLWorker.js | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/webGLWorker.js b/src/webGLWorker.js index 111378e0..00cb6e32 100644 --- a/src/webGLWorker.js +++ b/src/webGLWorker.js @@ -850,6 +850,7 @@ function WebGLWorker() { // Setup var dropped = 0; + var average = 0; var preMainLoop = Module['preMainLoop']; Module['preMainLoop'] = function() { if (preMainLoop) { @@ -866,8 +867,12 @@ function WebGLWorker() { var postMainLoop = Module['postMainLoop']; Module['postMainLoop'] = function() { if (postMainLoop) postMainLoop(); - postMessage({ target: 'gl', op: 'render', commandBuffer: commandBuffer }); - commandBuffer = []; + if (commandBuffer.length > 0) { + //average = (average + commandBuffer.length)/2; + //dump('buffer size: ' + Math.round(average) + '\n'); + postMessage({ target: 'gl', op: 'render', commandBuffer: commandBuffer }); + commandBuffer = []; + } }; } |