>
> > resulted in some kind of immediate mode exception add runtime, and how
> Hmm ??? Can you provide a StackTrace.

Ok, here is the StackTrace:

Exception occurred during event dispatching:
javax.media.j3d.IllegalSharingException: Background: Immediate mode
background m
ay not be in scene graph
        at
javax.media.j3d.BackgroundRetained.setLive(BackgroundRetained.java:39
9)
        at
javax.media.j3d.GroupRetained.doSetLive(GroupRetained.java:1475)
        at
javax.media.j3d.BranchGroupRetained.setLive(BranchGroupRetained.java:
101)
        at
javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:1009)
        at
javax.media.j3d.GroupRetained.checkSetLive(GroupRetained.java:869)
        at
javax.media.j3d.GroupRetained.doAddChild(GroupRetained.java:431)
        at javax.media.j3d.GroupRetained.addChild(GroupRetained.java:387)
        at javax.media.j3d.Group.addChild(Group.java:261)
        at
gis.services.gis3D.GIS3DView.createPrintCanvas(GIS3DView.java:1658)
        at
gis.services.gis3D.GIS3DGUIConfiguratorService$1.actionPerformed(GIS3
DGUIConfiguratorService.java:118)

Thats my method for creating the OffScreenCanvas3D:

// Background
        Background background = new Background(1,1,1);
        background.setApplicationBounds(mouseBounds);
        BranchGroup backgroundBg = new BranchGroup();
        backgroundBg.setCapability(BranchGroup.ALLOW_DETACH);
        backgroundBg.addChild(background);

        GraphicsConfiguration config =
SimpleUniverse.getPreferredConfiguration();
        OffScreenCanvas3D offScreenCanvas3d = new
OffScreenCanvas3D(config,true);
        // Set the off-screen size based on a scale factor times the
        // on-screen size
        //offScreenCanvas3d.setBackgroundNode(background);
        Screen3D sOn = c.getScreen3D();
        Screen3D sOff = offScreenCanvas3d.getScreen3D();
        Dimension dim = sOn.getSize();
        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;
        sOff.setSize(dim);
        sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth() *
                                    OFF_SCREEN_SCALE);
        sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight() *
                                         OFF_SCREEN_SCALE);
        // attach the offscreen canvas to the view

offScreenCanvas3d.getGraphicsContext3D().setBackground(background);
        offScreenCanvas3d.getGraphicsContext3D().clear();
        u.getViewer().getView().addCanvas3D(offScreenCanvas3d);
        Point loc = c.getLocationOnScreen();
        offScreenCanvas3d.setOffScreenLocation(loc);
        dim = c.getSize();
        dim.width *= OFF_SCREEN_SCALE;
        dim.height *= OFF_SCREEN_SCALE;
        scene.addChild(backgroundBg);
        offScreenCanvas3d.setBackgroundNode(background);
        //u.getViewer().getView().addChild(backgroundBg);
        //u.setJ3DThreadPriority( Thread.currentThread().getPriority() );
        //offScreenCanvas3d.preRender(background);

//offScreenCanvas3d.getGraphicsContext3D().setBackground(background);
        //offScreenCanvas3d.getGraphicsContext3D().clear();
        bImage = offScreenCanvas3d.doRender(dim.width, dim.height);
        backgroundBg.detach();

And here is the new version of OffScreenCanvas3D:

class OffScreenCanvas3D extends Canvas3D {

    Background background;

    OffScreenCanvas3D(GraphicsConfiguration graphicsConfiguration,
                      boolean offScreen) {

        super(graphicsConfiguration, offScreen);
    }

    public void preRender() {
        this.getGraphicsContext3D().setBackground(background);
        this.getGraphicsContext3D().clear();
    }


    BufferedImage doRender(int width, int height) {

        BufferedImage bImage =
            new BufferedImage(width, height, BufferedImage.TYPE_INT_ARGB);

        ImageComponent2D buffer =
            new ImageComponent2D(ImageComponent.FORMAT_RGBA, bImage);

        setOffScreenBuffer(buffer);
        renderOffScreenBuffer();
        waitForOffScreenRendering();
        bImage = getOffScreenBuffer().getImage();

        return bImage;
    }

    public void postSwap() {
        // No-op since we always wait for off-screen rendering to complete
    }


    public void setBackgroundNode(Background background) {
        this.background = background;
    }
}


> > chipset.
> Well life sucks ;). I just don't get it why it doesn't work offScreen but
> onScreen. Maybe I should check it again in the future. I'm not sure If I
> had installed the latest J3D Version on all testsystems.

I am still using Java3D 1.2

Thanks for your help Desiree

>
> EOF,
>  J.D.
>
> --
> Realtime Raytracer in JAVA
> (http://www.antiflash.net/raytrace)
>
> ===========================================================================
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
> of the message "signoff JAVA3D-INTEREST".  For general help, send email to
> [EMAIL PROTECTED] and include in the body of the message "help".
>

===========================================================================
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff JAVA3D-INTEREST".  For general help, send email to
[EMAIL PROTECTED] and include in the body of the message "help".

Reply via email to