Canvas3D -> JCanvas3D advice?

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Canvas3D -> JCanvas3D advice?

LordSmoke
Hello, folks. I haven't posted since last May, I think, when I was abroad and had the time to work intently on getting my graphics routines updated to jogl2 and the associated j3d. I have checked in periodically to see that development was active and ongoing. In the past couple of months, I have had some coding time and been working to polish other aspects of the program to get it ready for release. I have just finished cleaning and JavaDoc'ing its 93 classes and 83000+ lines of code. I am rather happy with it except for one little issue...

The program is designed as a main desktop window with internal frames. Alas, because of early heavyweight issues, the graphics reside in their own window outside of the program desktop.

Any advice on how to convert from Canvas3D to JCanvas3D and move the window to an internal frame would be appreciated, or a pointer to a simple JCanvas3D example or usage tutorial would be most helpful. The old stuff I have found online don't work for me.

Below is the constructor for my class that handles all of the j3d/jogl-specific code. None of my other classes know anything about j3d/jogl, and canvas (Canvas3D or JCanvas3D) is only accessed within this class to capture an image of the onscreen plot and in the plotting-panel class that adds the canvas to that panel. I have left some commented code from my initial fumblings at trying to get this conversion going.

TIA and best, LS.

PS: This is not a universe subclass. It just handles all universe management and access.

===================================================

    /**
     * A class providing basic methods for
     * creating and drawing scene components. E.g., points, lines,
     * 3d lines, etc. This class knows nothing about my data, and
     * none of the other classes know anything about j3d or jogl
     * other than color and coordinate data types.
     */
    public My_Universe() {
        super();
        // Get the preferred graphics configuration for the default screen
// JCanvas3D stuff
// GraphicsConfigTemplate3D gct = new GraphicsConfigTemplate3D();
// canvas = new JCanvas3D(gct, GraphicsEnvironment.getLocalGraphicsEnvironment().getDefaultScreenDevice().getBestConfiguration(gct));
// canvas = new JCanvas3D(new GraphicsConfigTemplate3D());
        GraphicsConfiguration config = SimpleUniverse
                .getPreferredConfiguration();
        canvas = new Canvas3D(config);
//JCanvas3D stuff
//canvas = new JCanvas3D(new GraphicsConfigTemplate3D());

//JCanvas3D stuff
// Must set size or no internal Canvas3D created?
// canvas.setSize(100,100);

        universe = new SimpleUniverse(canvas);

        universe.getViewingPlatform().setNominalViewingTransform();
        universe.getViewer().getView().setFrontClipDistance(universe.getViewer().getView().getFrontClipDistance() / 10);
        setProjectionPolicy(projectionPolicy);
        // Set up the offScreenCanvas for screen captures.
        GraphicsConfigTemplate3D gcTemplate = new GraphicsConfigTemplate3D();
        gcTemplate.setDoubleBuffer(GraphicsConfigTemplate3D.UNNECESSARY);
        GraphicsConfiguration gc = GraphicsEnvironment.getLocalGraphicsEnvironment()
                .getDefaultScreenDevice().getBestConfiguration(gcTemplate);
        offScreenCanvas = new MVis_OffScreenCanvas3D(gc, true);
        Screen3D sOn = canvas.getScreen3D();
//        JCanvas3D c = new JCanvas3D();

        Screen3D sOff = offScreenCanvas.getScreen3D();
        sOff.setSize(sOn.getSize());
        sOff.setPhysicalScreenWidth(sOn.getPhysicalScreenWidth());
        sOff.setPhysicalScreenHeight(sOn.getPhysicalScreenHeight());
        universe.getViewer().getView().addCanvas3D(offScreenCanvas);

        // Add some initial hints.
        clearUniverse();
        createDefaultScene();
        objRoot.compile();
        universe.addBranchGraph(objRoot);
    }
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

LordSmoke
PS: I am using...

3D [dev] 1.6.0-pre3-daily-experimental daily

and the jogl 2.0 libraries dated 31 October, 2012.
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

hharrison
I'm not sure it's worth converting to JCanvas3D, by the time we're done I think it will be best to go with direct Canvas3D use....JCanvas3D isn't so useful now.
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

LordSmoke
Harvey, remember me? We exchanged a few emails last year while I was working on this in Vienna.

 So that means there is no current option for a lightweight j3d that can be used with an internal frame? Or is there another option I am missing.

I have a student (supposedly) working on a pure jogl, shader-based port of my current j3d unit, but would be nice to move the plot frame onto the app desktop if that could be done easily.

Thanks for all your work, LS
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

hharrison
Yes, I remember that conversation, I had a bit of a brain fart and didn't see the internal frame part
of your question,  I'm assuming you mean JInternalFrame?  Looking at JCanavs3d, I don't _think_ anything
should have broken it, so it should be working as well as it ever did.  Let me know if it doesn't work like
you expect.

Harvey
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

gouessej
Administrator
In reply to this post by LordSmoke
Do you realize that we are in February 2013 and you use an outdated version of JOGL 2.0 built in October 2012?
Julien Gouesse | Personal blog | Website
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

LordSmoke
gouessej wrote
Do you realize that we are in February 2013 and you use an outdated version of JOGL 2.0 built in October 2012?
??? Yes, but the current-build jars are dated 01NOV2012. Mine were dated 31OCT2012 (not sure where they came from at this point). Are there more recent prebuilt jars? The source I downloaded a couple of weeks back didn't compile for me, IIRC.
Reply | Threaded
Open this post in threaded view
|

Re: Canvas3D -> JCanvas3D advice?

gouessej
Administrator
You can use the latest auto build which is preferable if you have to report a bug.
Julien Gouesse | Personal blog | Website