Should I update to LWJGL 3 (V2)

Started by Yuri6037, July 10, 2015, 18:49:56

Previous topic - Next topic

Yuri6037

Hello all,

That makes a long time I wasn't here, well I had work. I'm now back on and again I'm recreating this topic to be sure of some things about LWJGL 3.

To update my 2D GameEngine, I need several apis, are they implemented (or is there any equivalence) in LWJGL 3 :
- GL11 and GL12 classes
- AL10 and AL11 classes
- Mouse.isButtonDown, Mouse.getDWheel functions
- Keyboard.getEventKey, Keyboard.isKeyDown functions
- Display functions (setTitle, setIcon, ...)

Now I have a question about your official utility library : is it injected directly in the main jar, or is it an external jar I can decide to not include ? Indeed, on my current Engine, all the LWJGL util packages does not exist (everything done by GameEngine itself, WaveDecoder created in GameEngine, Texture Decoders too, and event a Vector2D class is already there.), so can I, if I want, remove all official librarys with LWJGL, I just want the GLFW/OpenGL/OpenAL bindings, nothing more, is it possible ?

And for the last question : can I now set my own Icon for the game ?

Thanks by advance,
Yuri.

quew8

Quote from: Yuri6037 on July 10, 2015, 18:49:56
- GL11 and GL12 classes
- AL10 and AL11 classes
- Mouse.isButtonDown, Mouse.getDWheel functions
- Keyboard.getEventKey, Keyboard.isKeyDown functions
- Display functions (setTitle, setIcon, ...)

-Yes.
-Yes
-Not directly but pretty simple to bridge the gap as it were. In GLFW, everything is handled by event callbacks.
-Ditto as above.
-Can set title. Cannot at the moment set the icon due to the way GLFW handles it (does it via a compile time #define)

Not sure which "official utility library" you are talking about. There isn't one as far as I know. If you want to get rid of all the bindings other than the ones you want then you will need to rebuild LWJGL yourself. Never done it before myself but I understand that there are compilation switches to make it fairly simple.

spasi

All bindings (GL, AL, CL, etc) are mostly compatible with LWJGL 2. There have been some fixes and improvements that are not source compatible, but you should be able to port your code very quickly. Many OpenGL extensions are currently missing in 3, please post here if you need any of those.

The functionality related to Display, Mouse and Keyboard must be rewritten. The old APIs are gone and you must now use the GLFW bindings. Overall it's much better than LWJGL 2 (API-wise and implementation-wise) and has rich documentation. It has several features that LWJGL 2 didn't have (e.g. support for multiple windows), but there's a single feature not currently implemented in GLFW: setting the window icon at runtime. It is planned for GLFW 3.2 (the next release).

LWJGL 3 does not have a utility library yet and likely never will. For vecmath, we currently recommend JOML, which is fantastic for modern OpenGL applications.

Cornix

I can only recommend upgrading to LWJGL3. The LWJGL team did a great job, big thanks to all of you. And GLFW is really nice as well; its much cleaner then before.
There is also new functionality that was not supported by LWJGL2 like having multiple windows and Drag&Drop as well as a Clipboard.

Yuri6037

Ok thanks to all, so I still need to wait because no icon for my application can be a bit problematic. I'll however try to see if I can make the basic GameEngine functions to work (DIsplay window, GL11 rendering and runtime texture modifier GL12).

What I mean by official library, is a part in the wiki saying that there will be an official one.
About the util i want to remove it was a file called lwjgl_util.jar in the old LWJGL 2. Is this file back ? Can I remove it like before (so the game engine is less heavy for hard drive) ?

EDIT : Please excuse me for my signature/profile icon : SLDT currently have some problems with the new version of the website blocking direct access to all our files including BANNERS and images/members folders.

EDIT 2 : What is the stb package in LWJGL jar ? Is it a helper for loading textures/sounds ?

EDIT 3 : alSource and alListener seams to be gone, not good for my sound system : it will no longer be able to load any sound so by the way no longer any play function.... Apparently using alSourcefv and alListenerfv solves the error in IntelliJ

spasi

There is no lwjgl_util.jar in LWJGL 3, so there's nothing to remove.

stb is a set of useful libraries. Not everything is included, see this post for details.

Yuri6037


spasi

Quote from: Yuri6037 on July 11, 2015, 07:54:33EDIT 3 : alSource and alListener seams to be gone, not good for my sound system : it will no longer be able to load any sound so by the way no longer any play function.... Apparently using alSourcefv and alListenerfv solves the error in IntelliJ

This is one of the fixes mentioned in my first reply. All the core functionality is there, only extensions may be missing.

Quote from: Yuri6037 on July 11, 2015, 08:15:15Can I remove this stb then ?

stb is currently built-in, but the LWJGL build system is modular: if you're able to build LWJGL manually, you can choose to not include stb. It's very useful and has minimal binary overhead though, why would you want to remove it?

Yuri6037

Ok thank you, I'll see if I can build that. The stb lib takes just place I saw your folder takes now 5 mb (which means 5mb to download for the player) the old just took 2 mb so....

Now I'm facing a new problem... the Sys.getTime and Sys.getTimerResolution are gone, how do I replace those ?


spasi

Quote from: Yuri6037 on July 11, 2015, 08:22:40Ok thank you, I'll see if I can build that. The stb lib takes just place I saw your folder takes now 5 mb (which means 5mb to download for the player) the old just took 2 mb so....

I think you're counting the javadoc and source archives. The binaries are much smaller than that.

Quote from: Yuri6037 on July 11, 2015, 08:22:40Now I'm facing a new problem... the Sys.getTime and Sys.getTimerResolution are gone, how do I replace those ?

You can use glfwGetTime() or System.nanoTime().

Yuri6037

Ok thanks.

And about Sys.getTimerResolution, what is the replacement for this method ?

spasi

You don't need it. glfwGetTime() always returns the time in seconds (double) and System.nanoTime in nanoseconds (long).

Yuri6037