Skip to content

Instantly share code, notes, and snippets.

@cecilemuller
Created May 9, 2012 10:51
Show Gist options
  • Save cecilemuller/2643689 to your computer and use it in GitHub Desktop.
Save cecilemuller/2643689 to your computer and use it in GitHub Desktop.
Save a screenshot programmatically in BS Contact
#VRML V2.0 utf8
Group {
children [
DEF sensor TouchSensor {}
Shape {
appearance Appearance {
material Material {}
}
geometry Sphere {}
}
]
}
DEF script Script {
eventIn SFTime onclick
url "javascript:
function onclick(){
/**
* Renders a screenshot of the current scene
* @param SFString Output filename
* @param SFInt32 Width (in pixels)
* @param SFInt32 Height (in pixels)
*/
Browser.renderToBitmap('test.jpg', 512, 512);
Browser.showConsole(true);
trace('The screenshot has been saved');
}
"
}
ROUTE sensor.touchTime TO script.onclick
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment