Blog: Easy 2D/3D Mixing in Swing

Since it may be relevant to folks on this forum (especially newcomers), I just wanted to mention a blog entry I wrote last week about mixing Java2D, JOGL, and Swing:
http://weblogs.java.net/blog/campbell/archive/2006/10/easy_2d3d_mixin.html

Source code and webstarted demo included. Covers things like a simplified version of GLJPanel, using Chet’s timingframework in a 2D/3D/Swing environment, the TextureIO utility classes, and more…

Thanks,
Chris

Cool stuff. I’ve added a link to your blog entry to the JOGL demos page and made this topic sticky for now.

I just posted another blog entry that covers things from the other perspective – using Java 2D elements (text, animated rendering, etc) from within a JOGL application:
http://weblogs.java.net/blog/campbell/archive/2007/01/java_2d_and_jog.html

Source code and webstarted demo included.

Thanks,
Chris

Excellent. I’ve linked to your blog posting from the jogl-demos web page as well.

Hi Chris,

Your “flip side” article is great, thanks!

These features are very exciting. Excuse the newb question. I’m
new to Java2D, and somewhat new to jogl. (Not to mention new
to posting)

I’ve tried the TextRenderer class, and it’s very easy to print
text over my jogl/openGL 3D animation. Very cool!

However, for a “chat box” I’d like a background, and also
boundry the TextRenderer text to the effective box boundries.

So I’m assuming this would be done with the Overlay class
you mention?

Are these two classes meant to operate together in this fashion?

Are there any examples of something like this?

Thanks much,

DarkDerivative

OK, from some study it looks like I need to use the TextureRenderer directly
instead of the TextRenderer or Overlay.

This is quite cool. Wish there was a little more docs for those of us who
are not so far along in jogl and/or Java2D. Am still kinda confused on
all the functions and copies (backing to texture to screen).

Not sure from the class docs why I seem to need both begin/end OrthoRendering,
and drawOrthoRect. But I guess it will hopefully become clear after more experiments.

But yeah, just wildly cool. I was kind of depressed looking at fonts in openGL earlier.
This came at a perfect time.

Thanks much,

DarkDerivative

It’s been mentionned that the TextureRenderer might use the JOGL / Java2D bridge. Any idea if/when that might happen?

The http://weblogs.java.net/blog/campbell/archive/2007/01/java_2d_and_jog.html demo seems to be broken with newer jogl-webstart-versions. In get an GLException when the demo tries to sync() the renderer.

I think import com.sun.opengl.util.j2d.* has been renamed in newer versions. Has anyone posted an updated version of this demo anywhere?

While it may be a trivial change once you know what you’re doing, I’m a big believer of having a demo that works first for those of us that are slow learners :slight_smile:

wasnt the sync() method replaced by markdirty()?

PhotoCube has been debugged to 1.5+ from source-code by myself : http://broumbroum84mirror3.ifrance.com/jnlp/demos/ :smiley:

All: I’m ashamed that it took me over six months to update the (one line of) source code to account for the change from sync() to markDirty() in the BezierAnim3D demo. Mea culpa. I’ve updated the source code and webstart binaries linked in the blog entry accordingly. I’ll hopefully post a more interesting demo in the near future…

Thanks, Chris.

The below classes:

org.jdesktop.animation.timing.Cycle;
org.jdesktop.animation.timing.Envelope;
org.jdesktop.animation.timing.TimingController;
org.jdesktop.animation.timing.TimingEvent;
org.jdesktop.animation.timing.TimingListener;
org.jdesktop.animation.timing.interpolation.ObjectModifier;
org.jdesktop.animation.timing.interpolation.PropertyRange;

…seem to be gone now from the TimingFramework. Will there be an update of this demo soon?