Can you use jME as a renderer and export the camera view to an image e.g. jpg?

Is it possible to use jMonkey Engine to create a 3d environment without showing it (for example on a server), and then generate/export the result to an image file like png or jpeg? If this is possible are there same examples available?



I have not been able to find the answer in the documentation or on the website.



Thank you very much for the help!



Martijn

I found an example of an image export as noted in thread http://www.jmonkeyengine.com/jmeforum/index.php?topic=3461.0



An example is in SimpleGame (so any game that derives from SimpleGame can already make screenshots, with F1). Not JPEG, but that's a matter of changing 1 line of code.



So my only question left is: can jME create a screenshot without showing the image on screen.

Indeed you can, the method depends on what you're up to.

If you don't want to show ANYTHING on screen, I think your best shot is to use a headless window (DisplaySystem.createHeadlessWindow()). My guess is that if you don't tell the AWT or Swing (or SWT) canvas to display the rendering result, you'll still be able to make screenshots. (disclaimer: I'm far from a jME or openGL expert :wink: )



(If instead you want to show an rendered image aside from your main GL window, offscreen rendering is your friend. I do it using a FrameBuffer Object, but if it's not supported by your graphic card I think you can do the same with a pbuffer. Look at LWJGLTextureRenderer and LWJGLPbufferTextureRenderer for inspiration. But if I understand your question, that's not the case)

Thank you for the pointers! I will try it this weekend!

Are there any news how this would work