Mixing Swing & OpenGL?

Started by mifritscher, October 31, 2011, 09:52:03 AM

Previous topic - Next topic

mifritscher

Hi,

can I mix Swing and OpenGL? I don't need only one big OpenGL Area, but a few small, e.g. (ASCII-art ;) )
G=OpenGL
S=Swing

SSSSSSSS
GGGSGGG
GGGSGGG
SSSSSSSS
SSSSSSSS
SSSSGGGG
SSSSGGGG
SSSSSSSS

Is something like this possible?

EgonOlsen

Short answer: Yes!

Long answer: Yes, but...

You can obtain an AWT canvas with the gl content from the FrameBuffer via this method: http://www.jpct.net/doc/com/threed/jpct/FrameBuffer.html#enableGLCanvasRenderer()
If you want multiple gl outputs, you can create multiple FrameBuffer for this. However, they are all heavyweight AWT components, i.e. the usual restrictions when mixing light- and heavyweight components apply.
In addition, some gl drivers seem to have problems with this mix...