aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlon Zakai <alonzakai@gmail.com>2014-06-19 13:16:19 -0700
committerAlon Zakai <alonzakai@gmail.com>2014-06-19 13:16:19 -0700
commit5ecf10671320d7bebbda27f3b7c36d48f41402fc (patch)
treec51bbffe82dfb68255cc9a6258ef6ba97c4dbb55
parentbd3f6efc59b8f39258176292e88f5a3c4a98e3ca (diff)
only send gl commandbuffer if contains content
-rw-r--r--src/webGLWorker.js9
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 = [];
+ }
};
}