Author Topic: Mixing Swing & OpenGL?  (Read 2128 times)

Offline mifritscher

  • byte
  • *
  • Posts: 1
    • View Profile
Mixing Swing & OpenGL?
« on: October 31, 2011, 09:52:03 am »
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?

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: Mixing Swing & OpenGL?
« Reply #1 on: October 31, 2011, 01:49:04 pm »
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...