Displaying offscreen fast…


For some reasons, i am rendering scene offscreen in my application.

I however need to show the offscreen buffer without speed penalty. Actually, i blit BufferedImage conversions of the texture, which takes ages to proceed.

Any hint on how to display (fullscreen most of the time) at max speed without using the frame provided by the engine?

Thank you.

Please find below the pseudo-code that i use

[java]class XXX extends SimpleApplication


public void init()


AppSettings customSettings = new AppSettings(true);

customSettings.setResolution(1, 1);



Camera offCamera = cameraConf.getCamera();

ViewPort offView = renderManager.createPreView(“OffRender_” + offCamera.getName(), offCamera);

offView.setClearFlags(true, true, true);


// create offscreen framebuffer

FrameBuffer offBuffer = new FrameBuffer(offCamera.getWidth(), offCamera.getHeight(), 1);

//setup framebuffer’s texture

Texture2D offTex = new Texture2D(offCamera.getWidth(), offCamera.getHeight(), Format.RGBA8);



//setup framebuffer to use texture



//set viewport to render to offscreen framebuffer


// attach the scene to the viewport to be rendered






Use JAVA code tags please. Nobody will want to help without that. It’s much harder to read. Besides, it also keeps formatting. Do yourself a favor if you want people to help.

1 Like

ok, sorry, did not see it.

Thanks for the kind remark.

I don’t understand the question. Are you trying to render a frame in jME3 and then retrieve it as a BufferedImage? Did you look at the source code for ScreenshotAppState?

He wants to do it “without a speed penalty”. Though it’s unclear what that means since there will always be a speed penalty from this approach.


I want to avoid getting it as a bufferedImage. I know i can retrieve it that way, which is something i already do for other tasks.

I would like to display the texture in a heavyweight canvas, as if it were a standard display buffer.

Have you looked at the swing/awt canvas stuff? There is a section on it in the docs…

See TestCanvas then. Except you won’t need the FrameBuffer as it renders directly to the canvas.