diff options
author | Alon Zakai <alonzakai@gmail.com> | 2014-06-06 16:00:14 -0700 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2014-06-06 16:00:14 -0700 |
commit | cec906c9c27fba775270e62aa3359489fe452c56 (patch) | |
tree | 171d122fc7148583d89738fb548451964ed657a9 /src/webGLWorker.js | |
parent | e1055ada578f6218b5c16104ea554cc74c831959 (diff) |
prepare to proxy gl commands
Diffstat (limited to 'src/webGLWorker.js')
-rw-r--r-- | src/webGLWorker.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/webGLWorker.js b/src/webGLWorker.js index 4a2f7bbb..eb230e51 100644 --- a/src/webGLWorker.js +++ b/src/webGLWorker.js @@ -8,6 +8,8 @@ function WebGLWorker() { this.prefetchedParameters = {}; this.prefetchedExtensions = {}; + var commandBuffer = []; + //=========== // Constants //=========== @@ -469,11 +471,21 @@ function WebGLWorker() { dump('worker getExtension ' + JSON.stringify(this.prefetchedExtensions) + '\n'); var i = this.prefetchedExtensions.indexOf(name); if (i < 0) return null; + // XXX send a msg, to enable it in the client return true; // TODO: return an object here }; this.getSupportedExtensions = function() { return this.prefetchedExtensions; }; + + // Setup + var postMainLoop = Module['postMainLoop']; + Module['postMainLoop'] = function() { + if (postMainLoop) postMainLoop(); + // frame complete, send the command buffer + postMessage({ target: 'gl', method: 'render', commandBuffer: commandBuffer }); + commandBuffer = []; + }; } |