Created
November 3, 2009 09:46
-
-
Save xeolabs/224920 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Installation of the SceneJS viewport node backend | |
| SceneJs.backends.installBackend( | |
| new (function() { | |
| this.type = 'viewport'; | |
| var ctx; | |
| this.install = function(_ctx) { | |
| ctx = _ctx; | |
| }; | |
| this.setViewport = function(x, y, width, height) { | |
| if (!ctx.canvas) { | |
| throw 'No canvas active'; | |
| } | |
| var context = ctx.canvas.context; | |
| context.viewport(x, y, width, height); | |
| context.clear(context.COLOR_BUFFER_BIT); | |
| }; | |
| })()); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment