Java-Gaming.org Hi !
Featured games (90)
games approved by the League of Dukes
Games in Showcase (715)
Games in Android Showcase (214)
games submitted by our members
Games in WIP (788)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  LWJGL2 using LWJGL3's image loading  (Read 1275 times)
0 Members and 1 Guest are viewing this topic.
Offline orange451

JGO Kernel


Medals: 266
Projects: 5
Exp: 6 years


Your face. Your ass. What's the difference?


« Posted 2016-12-15 17:39:25 »

Hi. Dumb question, but I am not on a computer at the moment.

Can I use lwjgl3's stb image loading library with LWJGL2?

First Recon. A java made online first person shooter!
Offline ziozio
« Reply #1 - Posted 2016-12-21 09:55:55 »

I think the answer is no
Offline princec

« JGO Spiffy Duke »


Medals: 899
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #2 - Posted 2016-12-21 10:30:20 »

You can use LWJGL2 and 3 at the same time AFAIK. And LWJGL3 is modular so you should be able to use just the image loading lib.

Cas Smiley

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline ziozio
« Reply #3 - Posted 2016-12-21 10:39:26 »

actually it looks like princec is correct, I haven't downloaded the modular setup before. The only thing you need to be careful on is the fact that you might have the same class in both lwjgl.jar's (2 version and 3 version)., I don't know what conflicts you might have or even if they matter, I'd just be weary Smiley
Offline KaiHH

JGO Kernel


Medals: 390



« Reply #4 - Posted 2016-12-21 11:14:21 »

I'm afraid, LWJGL2 and LWJGL3's core and stb modules are not interoperable.
The first problem you'll run into is that LWJGL2's jar files are sealed, so no other jar file is allowed to define classes in the org.lwjgl package. This can be circumvented by editing the jar file's MANIFEST.MF and simply removing the Sealed: true attribute.
The second problem is that the PointerBuffer and BufferUtils classes conflict and they are used throughout LWJGL3's core module.
So, when you have LWJGL's jar files specified in the classpath _before_ LWJGL3's jar files, you'll run into JVM bytecode verifier errors because PointerBuffer in LWJGL2 does not implement CustomBuffer (expected by classes from LWJGL3).
If you have LWJGL3's jar files before LWJGL2's jar files in the classpath, you'll run into a NoSuchMethodError when working with OpenGL methods, since LWJGL3's BufferUtils does not implement getElementSizeExponent() needed by LWJGL2.

Another problem is the natives. Not, that they have conflicting function exports, but that the shared library files have conflicting names. LWJGL2 uses 'lwjgl' and 'lwjgl64', whereas LWJGL3 uses 'lwjgl32' and 'lwjgl'.
If you are not very careful and load LWJGL2's natives from the file system (via java.library.path or LWJGL's alternative) and load LWJGL3's natives using the SharedLibraryLoader, you'll get native method not found exceptions.
For example, when you extract LWJGL2's shared libraries into one directory and LWJGL3's into another then either bootstrapping LWJGL2 or LWJGL3 will fail depending on the order of the file system paths in the java.library.path property.
Offline princec

« JGO Spiffy Duke »


Medals: 899
Projects: 3
Exp: 16 years


Eh? Who? What? ... Me?


« Reply #5 - Posted 2016-12-21 11:22:43 »

Ah, that's a bit of a pain.
I seem to recall mutterings about how all this stuff should have been hived off into totally separate projects a while ago...

Cas Smiley

Offline Spasi
« Reply #6 - Posted 2016-12-21 12:18:38 »

The class incompatibilities can be solved by using a separate ClassLoader for LWJGL 3.

The native library name is not a problem either. You can rename it in the jar and use -Dorg.lwjgl.libname to specify the new name.

But then you get into some wankery with System.loadLibrary that I didn't have the patience to solve. For something like this, I'd use a separate JVM and an IPC solution to transfer data.
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 116
Projects: 15


★★★★★


« Reply #7 - Posted 2016-12-21 12:38:43 »

I'd not bother trying to use two separate and incompatible versions of the same library, why not just drop LWJGL2 and update the project to use LWJGL3?
Offline orange451

JGO Kernel


Medals: 266
Projects: 5
Exp: 6 years


Your face. Your ass. What's the difference?


« Reply #8 - Posted 2016-12-22 03:13:57 »

I haven't been following lwjgl3 lately. Last time I tried it, I couldn't change from fullscreen to windowed dynamically, and that made me upset.

First Recon. A java made online first person shooter!
Offline SHC
« Reply #9 - Posted 2016-12-22 07:38:41 »

I haven't been following lwjgl3 lately. Last time I tried it, I couldn't change from fullscreen to windowed dynamically, and that made me upset.

You can do that now in the latest release. Just do call glfwSetWindowMonitor function.

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline orange451

JGO Kernel


Medals: 266
Projects: 5
Exp: 6 years


Your face. Your ass. What's the difference?


« Reply #10 - Posted 2016-12-22 14:50:01 »

Then I guess it's time to give it a try again Smiley

First Recon. A java made online first person shooter!
Pages: [1]
  ignore  |  Print  
 
 

 
CopyableCougar4 (125 views)
2017-03-24 15:39:42

theagentd (109 views)
2017-03-24 15:32:08

Rule (168 views)
2017-03-19 12:43:22

Rule (156 views)
2017-03-19 12:42:17

Rule (160 views)
2017-03-19 12:36:21

theagentd (174 views)
2017-03-16 05:07:07

theagentd (170 views)
2017-03-15 22:37:06

theagentd (139 views)
2017-03-15 22:32:18

theagentd (133 views)
2017-03-15 22:31:11

ral0r2 (156 views)
2017-03-03 11:52:41
List of Learning Resources
by elect
2017-03-13 14:05:44

List of Learning Resources
by elect
2017-03-13 14:04:45

SF/X Libraries
by philfrei
2017-03-02 08:45:19

SF/X Libraries
by philfrei
2017-03-02 08:44:05

SF/X Libraries
by SkyAphid
2017-03-02 06:38:56

SF/X Libraries
by SkyAphid
2017-03-02 06:38:32

SF/X Libraries
by SkyAphid
2017-03-02 06:38:05

SF/X Libraries
by SkyAphid
2017-03-02 06:37:51
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!