How to use AWTGLCanvas with jme3?

I am looking for an example implementation of the AWTGLCanvas with swing.



I want to create an editor with swing and jme3, so i need multiple viewports/canvases. I tried the JmeCanvasContext class and learned that you cannot run multiple instances of it. After researching a bit i read somewhere that the AWTGLCanvas class supports multiple rendering windows, but i no longer used by jmonkey since it is slower. For the editor, however, it is important that i have multiple rendering windows, but I am not experienced enough in lwjgl or jme to know how to interface jme with it.



I hope i explained myself clearly enough 8).

Its not possible, jMe3 doesn’t support multiple contexts even if lwjgl did. @Momoko_Fan

Hm do you really need multiple context in the smae application? Or would only application with one viewport each do? (and using own code to synchronize the displayed stuff)

Yes that only works with AWT panels though, theres a test class for that.

jME3 supports multiple applications assuming the context supports it.



@clickity: You should use AWT panels (See TestAwtPanels) instead of canvas for your application.

@Momoko_Fan said:
jME3 supports multiple applications assuming the context supports it.

..and the AWTPanels context doesn't.

@Normen: Didn’t you test it and say that it works?

@Momoko_Fan said:
@Normen: Didn't you test it and say that it works?

I said it starts but has issues, then you said you know why. I think its about the offscreen buffer object being a singleton but you wouldn't tell me.

Ok thank you. I am going to try both TestRenderToMemory and the TestAwtPanels approach in my application. I will report back here with information on which method performed better.

The TestRenderToMemory seems to be working fine for my purposes. By using this i avoid the potential problem I could have with TestAwtPanels, so I think im going to go forth using that method.

Running a Canvased Jmonkey window and a TestRenderToMemory window is much too taxing on my cpu. Its using 50% on an i7. If you use this method i would suggest running one viewport at a time.