Mixed Java2D and JOGL

Hi everybody,

Can someone tell me if it is possible to mix Java2D and JOGL drawing in the same double-buffered GLCanvas ?

Where should I put the java2D code ? In the display() method, casting the drawable parameter to a GLCanvas, getting a Graphic context and drawing ? I have tried that, but the Java2D drawing isn’t double buffered, and appears on top of the JOGL drawing.

Thanks.

Hi,

have you enabled texture mapping?

glEnable(GL_TEXTURE_2D)

Why are you using this article? I would suggest using a tutorial instead, for example Lessen 6 from nehe (http://nehe.gamedev.net/data/lessons/lesson.asp?lesson=06). For this lesson also a jogl port is available.

ciao torsten

Hi Wiederke,

I think your answer isn’t related to my question.

Currently it’s going to be non-trivial to mix the two. I think your best bet is to render either the Java2D or OpenGL bits into an offscreen buffer or image and use the other library to render those bits as either an image or texture.