ztellman / penumbra

not under active development - idiomatic opengl bindings for clojure
354 stars 43 forks source link

Difficulties running JOGL 2.0 on Windows x64 #1

Closed elliottslaughter closed 15 years ago

elliottslaughter commented 15 years ago

I'm having a rather difficult time getting penumbra to run on Windows 7 x64.

It looks like you've included the Linux version of some snapshot of JOGL 2.0 with penumbra, which I obviously can't use (because even if the jars are compatible, I still need the native dlls).

I tried using the copy of JOGL 1.1 which I used for cloggle, but it didn't work. (I don't remember the error any more...)

So then I tried installing the newest snapshot of JOGL 2.0. After fiddling with classpath and forgetting to set PATH and other stuff like that, I hit a bizzarre UnSatisfiedLinkException error. (And again I lost the exact error message.) Googling only returned one useful result (http://forum.worldwindcentral.com/showthread.php?t=13178) which suggested installing MS VC++ Redistributable package.

Now I don't get that error message any more, but I get the rather long winded and confusing error below (and googling really returns nothing useful this time).

Could you possibly consider making this compatible with JOGL 1.1? It might potentially avoid all this mess (and it's distributed with about 10 times less jar files...).

user=> javax.media.opengl.GLException: Invalid result 31 from GLCapabilitiesChooser (should be between 1 and 24) (gears.clj:1)
user=> Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Unable to create temp OpenGL context for device context 0x6601097a
    at com.sun.opengl.impl.windows.wgl.WindowsWGLContext.create(WindowsWGLContext.java:147)
    at com.sun.opengl.impl.windows.wgl.WindowsWGLContext.makeCurrentImpl(WindowsWGLContext.java:266)
    at com.sun.opengl.impl.windows.wgl.WindowsOnscreenWGLContext.makeCurrentImpl(WindowsOnscreenWGLContext.java:65)
    at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:120)
    at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:141)
    at javax.media.opengl.awt.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:553)
    at javax.media.opengl.awt.GLCanvas.display(GLCanvas.java:290)
    at javax.media.opengl.awt.GLCanvas.paint(GLCanvas.java:368)
    at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
    at sun.awt.RepaintArea.paint(RepaintArea.java:224)
    at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:306)
    at java.awt.Component.dispatchEventImpl(Component.java:4706)
    at java.awt.Component.dispatchEvent(Component.java:4460)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
elliottslaughter commented 15 years ago

I just tried this in Linux (x86) and it worked (other than the fact that I again had to download JOGL because you seem to have included non-x86 binaries...).

I still get lots of exceptions printed to the terminal but at least it runs :-)

elliottslaughter commented 15 years ago

Just reproduced the error in Windows XP 32-bit, so I guess this isn't tied specifically to 64-bit, and it isn't tied to that redistributable package (because I have Visual Studio Pro installed on my 32-bit system).

Now I really don't know what is causing this error....

ztellman commented 15 years ago

I've been doing my development on a Mac, and haven't tested it on any other platform. I have a Windows box, though, so I'll set things up and see what's going on.

One thing to remember is that the jars need to go in your class path, or (System/getProperty "java.class.path") at the REPL, but the .so and .jnilib files need to go in your library path, or (System/getProperty "java.library.path").

As to the 2.0 vs 1.1 question, I am making use of the better extension support in 2.0, and would be hesitant to throw that away. I'll see if I can reproduce your issues in Windows, and we'll go from there.

aking commented 15 years ago

I've been using it under both WinXP-32 and linux and would be against downgrading back to jogl 1.1.1 (don't want to lose ES support). In case it helps, here's the bat file I'm using under windows:

set CLOJURE_JAR="/jars/clojure.jar;/jars/clojure-contrib.jar" set PEN_JAR="%CLOJURE_JAR%;/jars/jogl/lib/jogl.all.jar;/jars/jogl/lib/nativewindow.all.jar;.;/jars/jogl/lib/gluegen-rt.jar;/jars/jogl/lib/newt.all.jar;" IF (%1)==() ( java -cp %PEN_JAR% clojure.lang.Repl ) ELSE ( java -Xss32m -Dsun.java2d.noddraw=true -server -cp %PEN_JAR% clojure.lang.Script %1 -- %* )

And my %PATH% includes a link to the /jars/jogl/lib dir.

I did have to make one other change in penumbra/windows.clj for it to work under windows - I had to comment out the 'doto cap' expression at line 60.

ztellman commented 15 years ago

That 'doto cap' expression is to turn on anti-aliasing. I'm not sure why it's not working, but it's far from mandatory. I guess I'll be commenting that out until I figure out how to detect whether or not it's supported.

Elliot: you mentioned having to download a different platform-specific release of JOGL. I was surprised to read that, and aking's comment seems to suggest it's not necessary. I want to include all the necessary libraries in /lib, but I don't want to have three different versions if all I need is one. If any of the above suggestions work for you, please check whether they also work with the libraries in the repository.

elliottslaughter commented 15 years ago

It's not the jars that are the problem (they already encompass all version), it's the .so files that you've included in the lib directory. My understanding is that those libraries will need to be specific to the platform being run.

It looks like aking included /jars/jogl/lib in %PATH%, which I'm guessing came from a separate install of JOGL. Please correct me if I'm wrong on this.

How stable is JOGL 2.0 generally? Is it possible that the daily build has broken between when you installed JOGL and when I attempted to use it?

I'll try again this evening.

ztellman commented 15 years ago

I believe JOGL 2.0 is fairly stable, even if it's just a daily build. I've been using those exact same .jar and .so files in OS X, so if an error exists, it must be platform specific. I haven't had a chance to run anything in Windows, so that could certainly be the case.

Just to confirm, in Windows you're currently able to compile everything using the latest JOGL 2.0 daily, but immediately get a runtime exception? If that's an accurate characterization, try commenting out the anti-aliasing code at the top of src/window.clj and see if that fixes it. If that's not accurate, please correct me.

elliottslaughter commented 15 years ago

The anti-aliasing code was the problem. Commenting out the expression at penumbra/window.clj:60 fixed the problem.

Thanks.

ztellman commented 15 years ago

I've commented out the anti-aliasing code, pending some code that will detect whether or not it will hose everything. Issue appears to be resolved.