Skip to content

Instantly share code, notes, and snippets.

@xeolabs
Created November 3, 2009 09:46
Show Gist options
  • Select an option

  • Save xeolabs/224920 to your computer and use it in GitHub Desktop.

Select an option

Save xeolabs/224920 to your computer and use it in GitHub Desktop.
// 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