Problems loading native libraries

Hi all,

I’m new in this forum and to JOGL programming (but I have experience working with the OpenGL API in other languages). I’m currently working on a standalone application which use the NetBeans Platform. The current graphic engine uses JOGL 1.1 and the fixed pipeline for rendering and I have the job to rewrite it to use the new features available in the last OpenGL versions. Unfortunately, I’m unable to get JOGL 2 working.
I have created a wrapper module for the libraries “gluegen-rt.jar jogl.all.jar nativewindow.all.jar newt.all.jar”. I have then make public the packages I need. It works and the other modules are able to see the JOGL classes. The problem is that I’m not able to load the correct native libraries. There is no problem if I choose a platform and insert the libraries directly in the modules/lib folder, but I don’t know how to change the native library location at runtime based on the current platform.

Thank you for your help.

Welcome apatriarca,

you could use the library wrapper and native-lib-support module from the NB OpenGL Pack.


http://projectkenai.com/projects/netbeans-opengl-pack/downloads/directory/early-access
they ship with an around one year old JOGL 2 build but we will update them as soon as there is a final JOGL 2 release available.

Thank you for your help. I have studied the code of the class and I am unsure if it is what I really need. In fact, If I understood it correctly, the NativeLibSupport class copy the native libraries in a particular folder and/or archive to another folder (which will be distributed alongside the library code). I can’t distribute different versions of my module (one for each OS/CPU pair) and I have to load the correct library at module loading. My main problem is probably that I don’t know how to change module loading behavior to use the correct library based on the OS and CPU. It is probably more related to NetBeans then JOGL, but I think you may have encountered the same problem before.