? Widgets that overlap the GLCanvas...

Hello,

This week I began tinkering around with OpenGL and JOGL in particular. The first thing I wanted to do was to learn a bit about creating a GUI before I got into any OpenGL specific code. Here are my questions:

  1. In games like Dungeon Siege and others, they use
    nifty translucent windows for inventory screens etc.
    that overlap the drawing area. The first thing I tried
    was to create an OPAQUE ‘inventory screen’ using a
    heavyweight component ( JDialog ). The dialog
    dutifully appeared, and behaved as normal, but the
    animation of the GL drawing slowed quite a bit ( I
    used on of the early NeHe tutorials as a guinea pig).
    Thoughts on that? I forgot to mention it, but here is
    the setup: An AWT Frame containing a GLCanvas
    added to it’s BorderLayout.CENTER, with a JDialog
    using the Frame as it’s parent. Anyway…how to use
    opaque widgets without slowing animation?

  2. How to use translucent widgets? I don’t see any
    methods to .addComponent() to the GLCanvas, so
    I’m stuck.

Thanks much

GLCanvas is a heavyweight drawing area - nothing with overlap it as per Z ordering of heayweight components, the GLCanvas will be drawn last.

What you’re referring to aren’t GUI components, they’re part of the actual application being rendered in DirectX. To do something similar you would have to draw your GUI widgets in OpenGL and since there isn’t any immediate plan to render the entire GUI system in OpenGL, there can be no overlap between the two.

IIRC, even JDialog isn’t heavyweight. Its just rendered in a modal manner on the swing thread. So your performance loss could be coming from the context switching between the Swing thread and the AWT rendering system for GLCanvas.

[quote]To do something similar you would have to draw your GUI widgets in OpenGL
[/quote]
…and if you would like to do something like this, you can take a look on Xith3D GUI rendering subsystem, which allows to draw Swing components inside OpenGL context (i.e. directly in 3D scene).

Yuri

Thanks for the advice :slight_smile: