Author Topic: Render Offscreen without showing display  (Read 1836 times)

Offline nuvolanotturna

  • byte
  • *
  • Posts: 6
    • View Profile
Render Offscreen without showing display
« on: December 19, 2010, 07:58:18 pm »
Hi,
I'm trying to render a 3d scene offscreen on an image. It works but (only in the case I use a hardware render) it opens a window, just for a few seconds. Is it possible to avoid the display to be shown?

Here is my code:

Code: [Select]
        buffer = new FrameBuffer(800, 600, FrameBuffer.SAMPLINGMODE_GL_AA_4X);
        buffer.disableRenderer(IRenderer.RENDERER_SOFTWARE);
        buffer.enableRenderer(IRenderer.RENDERER_OPENGL);

        buffer.clear(java.awt.Color.LIGHT_GRAY);
        world.renderScene(buffer);
        world.draw(buffer);
       
        String name = "/test" + Math.random() + ".png";
        System.out.println(name);
        ImageIO.write((BufferedImage) buffer.getOutputBuffer(), "png", new File(name));

        buffer.disableRenderer(IRenderer.RENDERER_OPENGL);
        buffer.dispose();

If I use the software render it does not open any window, while if I use the hardware render it opens a window and then just closes it (without showing anything). Is there some kind of configuration I can set to avoid any window to show?

Thanks for any help

Eve
 

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Render Offscreen without showing display
« Reply #1 on: December 19, 2010, 08:40:46 pm »
I guess not. The window has the GL context. No window, no context.

Offline nuvolanotturna

  • byte
  • *
  • Posts: 6
    • View Profile
Re: Render Offscreen without showing display
« Reply #2 on: December 20, 2010, 03:46:10 pm »
ok..thanks :P