www.jpct.net

jPCT - a 3d engine for Java => Support => Topic started by: nuvolanotturna on December 19, 2010, 07:58:18 pm

Title: Render Offscreen without showing display
Post by: nuvolanotturna 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
 
Title: Re: Render Offscreen without showing display
Post by: EgonOlsen on December 19, 2010, 08:40:46 pm
I guess not. The window has the GL context. No window, no context.
Title: Re: Render Offscreen without showing display
Post by: nuvolanotturna on December 20, 2010, 03:46:10 pm
ok..thanks :P