[FIXED] So I got excited by LWJGL 3 and wrote a new DDS loader for it ...

Started by lightbringer, November 20, 2014, 01:41:39

Previous topic - Next topic

lightbringer

... only to realize two days late that I can't actually load this stuff into OpenGL since EXTTextureCompressionS3TC has not been brought over yet. Doh.  :'(

It would be awesome if you guys add it back again. For now I'll have to live with uncompressed textures.

Oh, and congrats on the rollout. New site looks seriously rad.

spasi

Hey lightbringer,

A new nightly build is up that includes EXT_texture_compression_s3tc. Let me know if there's any other extension you need.

lightbringer


lightbringer

I ran into some trouble.

I upgraded from build 13 to build 16 to take advantage of your additions but I can't get the native library work.

All my native libraries live in the working directory, under "lib/native" with the directory structure mirroring LWJGL, ie lib/native/windows/x64 etc.

With build 13 I use -Djava.library.path=lib/native/windows/x64 as VM option and it works.

So far for build 16 I've tried (debugging by trial and error :-) ):
-Djava.library.path=lib/native/windows/x64
-Djava.library.path=lib/native/windows
-Djava.library.path=lib/native
-Djava.library.path=/lib/native
-Djava.library.path=lib/
-Dorg.lwjgl.librarypath=lib/native/windows/x64
-Dorg.lwjgl.librarypath=lib/native/windows
-Dorg.lwjgl.librarypath=lib/native
-Dorg.lwjgl.librarypath=lib
-Dorg.lwjgl.librarypath=lib/native/windows/x64/lwjgl.dll
-Dorg.lwjgl.librarypath=E:\Dropbox\private\projects\solariad\redist\lib\native\windows\x64\lwjgl.dll


as well as directly calling each of these (separately):

System.load(System.getProperty("user.dir") + "/lib/native/windows/x64/lwjgl.dll");
System.setProperty("org.lwjgl.librarypath",System.getProperty("user.dir") + File.separator + "native");
System.setProperty("org.lwjgl.librarypath",System.getProperty("user.dir") + File.separator + "native" + File.separator + "windows");
System.setProperty("org.lwjgl.librarypath",System.getProperty("user.dir") + File.separator + "native" + File.separator + "windows" + File.separator +"x64");



But in all cases I get:

Exception in thread "main" java.lang.ExceptionInInitializerError
	at com.solariad.client.HelloWorldGLFW.execute(HelloWorldGLFW.java:27)
	at com.solariad.client.HelloWorldGLFW.main(HelloWorldGLFW.java:89)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:134)
Caused by: java.lang.NullPointerException
	at org.lwjgl.LWJGLUtil.loadLibrarySystem(LWJGLUtil.java:321)
	at org.lwjgl.Sys$1.run(Sys.java:36)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.lwjgl.Sys.<clinit>(Sys.java:33)
	... 7 more


It varies a bit, it's LWJGLUtil.java:326 when there is no org.lwjgl.librarypath so at least it gets as far as reading the librarypath property.

Is there maybe a bug in there somewhere or am I missing something obvious? What's the correct usage now?

spasi

Assuming . is the working directory (in which the JVM is launched) and the native libraries are in ./lib/native/os/arch, then either -Djava.library.path=lib/native or -Dorg.lwjgl.librarypath=lib/native ought to work. It should also work with the specific os/arch (i.e. lib/native/windows/x64), but then you'd have to change it based on the target system.

I see you're launching your application from inside IntelliJ. Go to Run -> Edit configurations and make sure the Working directory setting is pointing to the correct location.

If you're still having trouble, I'd like to see the full stacktrace. The stacktrace above does not contain the line from which the NPE was thrown.

lightbringer

Thanks for your fast reply!

Your assumptions are correct. The actual directory I am launching from is

E:\Dropbox\private\projects\solariad\redist

and that's what IntelliJ is configured for as "working directory". The libraries get copied under that (and yes, I checked, they are there :)).

Neither of your two suggested VM options works for me, unfortunately. Not with os/arch specifics either.

What I posted was, as far as I can tell, the full stacktrace. Same as what printStackTrace() prints. The  "7 more" are on lines 2 to 8. Is there some method to get even more detail? I tried System.setProperty("org.lwjgl.util.Debug","true"); but it didn't print anything particularly useful, just the version number for LWJGL.

lightbringer

I think I figured it out. In LWJGLUtil.java I took out some code and ran it from my main(). I got an

java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: lib/native\lwjgl.dll

inside loadLibrary(). System.load() apparently needs an absolute path but you are passing it a relative path.

I tested with -Djava.library.path=E:\\Dropbox\\private\\projects\\solariad\\redist\\lib\\native and this indeed did work as expected.

spasi

Thank you lightbringer, it has been fixed now. Please try the latest nightly build.

lightbringer

Build 17 works as expected with -Djava.library.path=lib/native

Thanks!