This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

OpenGL works! Was: Re: GCJ and OpenGL under Win32


I finally figured the problem out. I rebuilt the SWT OpenGL dll with mingw32, for some reason Sun's VM loads mangled names in JNI dlls and GCJ doesn't.

To get the DLL to build I added:

-D_JNI_IMPLEMENTATION_ -Wl,--kill-at

To my makefile when linking with mingw32.

I've put a demo app here: http://svf.dreamhost.com/gcj/swt-ogl.zip
And the fixed swt-opengl dll here, in case anyone wants to use it: http://svf.dreamhost.com/gcj/gl-win32.dll
The rest of SWT's experimental opengl implementation is here: http://dev.eclipse.org/viewcvs/index.cgi/platform-swt-home/opengl/opengl.html?rev=1.13


Took me several hours to get this working... being my first experience with JNI, hopefully no one else has to go through all the work :-)

Next to try to get this to work on linux...

- Sal

I've been looking for a way to get GCJ and OpenGL to work together under win32. I've tried different OpenGL libs with GCJ and had little luck... jogl uses Swing stuff that chokes gcj, lwgl gives many compile/link errors, but SWT's experimental OpenGL seems to almost work.

I had problems building SWT 3.0.1, recieved some 'Validation failed' errors when I was compiling, but I managed to work around it by adding the SWT source to my project directly. There seems to be some problem with compiling SWT 3.0.1 from its .jar file. Also GCJ picked up some errors in the SWT source that Sun's compiler must have missed (a method was overridden with the wrong return value).

After that I tried to build the 'experimental' OpenGL library for SWT. I had to build it from source also, recieved errors trying to build it from the jar file.
All seems to work fine with SWT and OpenGL, my test application compiles and links. But when I run my application I get:


Exception in thread "main" java.lang.UnsatisfiedLinkError: gluPerspective
  at 0x00651ffe (Unknown Source)
  at 0x006519d2 (Unknown Source)
  at 0x00652944 (Unknown Source)
  [... repeat long traceback here...]

I've put the gl-win32.dll in the executable directory, along with the SWT dll. I've also tried modifying my makefile to link with libglu32 & libopengl32 that come with mingw32. (using -llibglu32 etc.) But continue to recieve the 'UnsatisfiedLinkError' at runtime. Can anyone give some advice on this?

If anyone has been able to get an OpenGL implementation to work under GCJ I would be interested in hearing about it, also!

Thanks much in advance,

- Sal



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]