LWJGL 2 migration guide to LWJGL 3

Started by spasi, September 03, 2015, 09:55:10

Previous topic - Next topic


If you'd like to port your existing LWJGL 2 code to LWJGL 3, please read:

The LWJGL 3 Migration Guide


Can I embed LWJGL3 in awt.Canvas still? Will this be supported eventually?

My GUI is done in swing and I've invested a large amount of effort into it. I want to upgrade to LWJGL3 for the multi-display through GLFW, but that won't matter if I can't put it in my swing because of it.  Is upgrading the right choice for me?



There is no AWT integration in LWJGL 3 and there are no plans to add it later. You can find some old posts in this forum that explain why.

We currently have an open issue for a GUI solution in LWJGL 3, but it is not a showstopper in any way. We'll gladly accept any robust and low-maintenance solution. Having multiple solutions for different needs is OK too.

Technically, LWJGL 2's AWT integration could probably be implemented in terms of LWJGL 3. If anyone would like to contribute something, I'll make sure any required changes to LWJGL 3 will be accepted (should be few/minor).

I have personally made some progress with an LWJGL-backed JavaFX pipeline, here.


That's what I was afraid of. Making one myself is beyond my skill set. My realistic choices are to LWJGL2+swing, or LWJGL3+some GUI library. Before I settled on swing (probably a mistake in retrospect) I experimented with some of these.  But if I understand correctly, none of them would work with LWJGL3 currently.


I am planning to do what @Spasi proposed: Taking the good and working classes from LWJGL2, which do OpenGL context creation themselves via JNI, and porting them to the native platform API exposed as Java methods by LWJGL3. This should not be too much work, as it is mostly changing the names of referenced exception types and utility methods and classes which moved/changed/have been removed.
Although I would favor a clean solution for context and window creation (whatever "clean" means in this context). But this will distill itself, I guess, from the AWT and coming SWT implementations.


I have been working on a GUI library for about a year now. The library is completely platform independent and thus could be used with LWJGL 3. Unfortunately progress is slow and it is not on the same level as Swing by far. Perhaps I am going to publish it here some day.