Swing and OpenGL

As you might now, I have been playing with JOGL recently. I just tried something interesting with both JOGL and Swing: having a full OpenGL scene as a JButton icon. Here is the (crappy looking :) result:

The 3D scene is adapted from the famous Gears OpenGL demo. When the mouse cursor enters the button area, the gears rotate on itself and around the Y axis. The next step would be to display the “icon” crossing the boundaries of the button. I am also waiting for a way to enable antialiasing with a transparent OpenGL/Swing panel. I'm sure the result would look much much better.

This little test made me think of billions of cool effects. You could, for instance, create a button that would be deformed in 3D on user's click.

Comments are closed.