Rendering scene without canvas and export screenshot

Dear JME Team,

i need to implement a shell based component in my system that does nothing more than creating a pre-configured scene graph, render it and export it as a screenshot, xml file or any other output format. What is the best way to do this without opening any canvas or other gui related components, or could you point me to the corresponding tutorial?

Best Regards
Moe

start(Headless) for application.

@Empire Phoenix said: start(Headless) for application.

Nah, you don’t get any rendering output then. You’d need to use AWT Panels to start an offscreen renderer and then hide the AWT panel, rendering your image as in TestRenderToMemory.

So i tried to setup a jme application with AWTPanelsContext, created a canvas, added it to a JFrame and displayed it to take a screenshot. On my local computer it works fine, but running it on the server generated the following exception. Any hints?

It seems like there is no graphics card found. The server is a virtual machine.

[java]org.lwjgl.LWJGLException: Pixel format not accelerated
at org.lwjgl.opengl.WindowsPbufferPeerInfo.nCreate(Native Method)
at org.lwjgl.opengl.WindowsPbufferPeerInfo.<init>(WindowsPbufferPeerInfo.java:47)
at org.lwjgl.opengl.WindowsDisplay.createPbuffer(WindowsDisplay.java:718)
at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:219)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:190)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:166)
at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:342)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:474)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:113)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)

org.lwjgl.LWJGLException: Pixel format not accelerated
at org.lwjgl.opengl.WindowsPbufferPeerInfo.nCreate(Native Method)
at org.lwjgl.opengl.WindowsPbufferPeerInfo.<init>(WindowsPbufferPeerInfo.java:47)
at org.lwjgl.opengl.WindowsDisplay.createPbuffer(WindowsDisplay.java:718)
at org.lwjgl.opengl.Pbuffer.createPbuffer(Pbuffer.java:234)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:219)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:190)
at org.lwjgl.opengl.Pbuffer.<init>(Pbuffer.java:166)
at com.jme3.system.lwjgl.LwjglCanvas.makePbufferAvailable(LwjglCanvas.java:342)
at com.jme3.system.lwjgl.LwjglCanvas.createContext(LwjglCanvas.java:474)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:113)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)
Mai 26, 2014 8:42:26 AM org.btu.sst.softurbs.jme.common.CityApplication handleError
Schwerwiegend: Failed to create display
java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
at org.lwjgl.opengl.GL11.glGetString(GL11.java:1782)
at com.jme3.system.lwjgl.LwjglContext.printContextInitInfo(LwjglContext.java:84)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:114)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)

java.lang.RuntimeException: No OpenGL context found in the current thread.
at org.lwjgl.opengl.GLContext.getCapabilities(GLContext.java:124)
at org.lwjgl.opengl.GL11.glGetString(GL11.java:1782)
at com.jme3.system.lwjgl.LwjglContext.printContextInitInfo(LwjglContext.java:84)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:114)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Unknown Source)
Mai 26, 2014 8:42:26 AM com.jme3.system.lwjgl.LwjglAbstractDisplay run
Schwerwiegend: Display initialization failed. Cannot continue.[/java]

Well this is mostly due to that VM’s rarely have 3d capable graficcards, as they are to expensive to emulate.

I’ve already searched for in the forums but does jme has any software rendering modules? Performance is no problem - it’s typically done in a nightly.

The application for the tool is to generate thematical software maps for large scaled software systems. To achieve this the tools is integrated to a jenkins server that renders the software city and stores it in a given format like png, scene, … Is there any other way without adding a new slave with dedicated graphics hardware to the jenkins build?

@oOMoeOo said: I've already searched for in the forums but does jme has any software rendering modules? Performance is no problem - it's typically done in a nightly.

The application for the tool is to generate thematical software maps for large scaled software systems. To achieve this the tools is integrated to a jenkins server that renders the software city and stores it in a given format like png, scene, … Is there any other way without adding a new slave with dedicated graphics hardware to the jenkins build?

No, the graphics output is generated by shaders which in turn have to run on a GPU. Maybe you can find some GPU emulation in the form of some “fake” driver, idk.

Well some linux are able to simulate at least a subset of opengl in software, this might help

Another solution would be to just use an old computer as a jenkins slave and put a 30€ graficcard in it.

@Empire Phoenix said: Well some linux are able to simulate at least a subset of opengl in software, this might help

Another solution would be to just use an old computer as a jenkins slave and put a 30€ graficcard in it.

Yeah that seems to be the easiest solution. I just this minute tested the scenario on a virtualized centos server (xen virtualization environment) but with a window manager installed. That worked with a valid output.