OS/X OpenGL
Michael Hall
mik3hall at gmail.com
Wed May 10 08:02:34 UTC 2023
Still looking at this a little bit from time to time.
On my prior I noted java invocation including something like…
DYLD_PRINT_LIBRARIES=1 DYLD_PRINT_APIS=1
These do not appear to work. In looking I am currently assuming this is due to dlopen is not used. Is this correct?
I saw that it appears JNI loading can be used...
System.load("/opt/X11/lib/libglut.dylib”);
That I assume would restore the above to working? However, load doesn’t appear to do so that I’ve noticed and loadLibrary for some reason isn’t working for the libraries of interest getting link errors.
With load it appears I need to use…
SymbolLookup loaderLookup = SymbolLookup.loaderLookup();
To access things via the class loader.
OS/X seems to have removed some of its OpenGL support from frameworks. So I am trying to build something to use from Mesa. Quartz X11 also still seems to provide some of this.
Being unsure I was in fact getting the correct version of the libraries and with loadLibrary not working I went to this running on the main thread…
private static final Arena MAIN_ARENA = Arena.openConfined();
SymbolLookup libraryLookup = SymbolLookup.libraryLookup("/Users/mjh/Documents/java/panama/mesa-23.0.1/os/lib/libGL.dylib", MAIN_ARENA.scope());
With this to manage the symbol lookup…
SYMBOL_LOOKUP = name -> libraryLookup.find(name); // .or(() -> loaderLookup.find(name)); // .or(() -> LINKER.defaultLookup().find(name));
This errored because I am currently omitting the class loader lookup needed for the libglut.dylib above. I also failed to chain all three lookups probably because I’m not that familiar with the lambda syntax.
It did occur to me that I could simplify somewhat if I combined the libGL and and libglut. So the actual question/suggestion is would it make sense to have libraryLookup allow a list of paths to be provided?
Like the java.class.path or java.library.path system properties do?
More information about the panama-dev
mailing list