thothbot / parallax

Cross-platform Java 3D SDK
http://thothbot.github.io
MIT License
84 stars 26 forks source link

Screenshots of scenes or camera view #92

Open andnovar opened 8 years ago

andnovar commented 8 years ago

I have been going through the API to check whether is possible to get a screenshot of the scene or from the camera view. Is it possible now ? Any idea how can I contribute maybe if not solved ?

thothbot commented 8 years ago

Hey, yes it is possible.

WebGL uses canvas element, where you can get an image using .toDataURL() js-method. Need to check if it is implemented in gwt, if not it is easy to add it (but for gwt-platform only)

andnovar commented 8 years ago

https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/toDataURL I see the method. Seems like GWT does it --> http://www.gwtproject.org/javadoc/latest/com/google/gwt/dom/client/CanvasElement.html#toDataUrl(java.lang.String) It could be cool to add to the scene a method to call this directly to get a png/jpg. I think I can add this and do a pull request later on.

thothbot commented 8 years ago

Will be cool!