Author Topic: javax.media.opengl.GLException  (Read 8209 times)

Offline jmoliere

  • Enjoying the stay
  • *
  • Posts: 29
    • AOL Instant Messenger - Molamini
    • View Profile
javax.media.opengl.GLException
« on: 18. June 2008, 07:24:50 PM »
Hello,
I have checked out the latest and greatest of Xith from SVN, has anyone seen this exception?  I'm getting it on Windows (32 bit libraries).  I have tested this with the 64 bit linux libraries and all works well.


javax.media.opengl.GLException: java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
        at org.xith3d.render.jsr231.CanvasPeerImplAWT.initRenderingImpl(CanvasPeerImplAWT.java:754)
        at org.xith3d.render.DefaultRenderer.doRender(DefaultRenderer.java:494)
        at org.xith3d.render.DefaultRenderer.renderOnceInternal(DefaultRenderer.java:657)
        at org.xith3d.render.DefaultRenderer.renderOnce(DefaultRenderer.java:783)
        at org.xith3d.base.Xith3DEnvironment.render(Xith3DEnvironment.java:440)
        at org.xith3d.loop.RenderLoop.renderNextFrame(RenderLoop.java:619)
        at org.xith3d.loop.RenderLoop.loopIteration(RenderLoop.java:642)
        at org.xith3d.loop.RenderLoop.update(RenderLoop.java:698)
        at org.xith3d.loop.UpdatingThread.nextIteration(UpdatingThread.java:473)
        at org.xith3d.loop.RenderLoop.nextIteration(RenderLoop.java:709)
        at org.xith3d.loop.RenderLoop.loop(RenderLoop.java:762)
        at org.xith3d.loop.UpdatingThread.run(UpdatingThread.java:526)
        at org.xith3d.loop.RenderLoop.run(RenderLoop.java:785)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:189)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:452)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:189)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
        at java.awt.Component.dispatchEventImpl(Component.java:4489)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:189)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
        at java.awt.Component.dispatchEventImpl(Component.java:4489)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:189)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
        at java.awt.Component.dispatchEventImpl(Component.java:4489)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Exception in thread "AWT-EventQueue-0" javax.media.opengl.GLException: Attempt to make the same context current twice on thread Thread[AWT-EventQueue-0,6,main]
        at com.sun.opengl.impl.GLContextLock.lock(GLContextLock.java:83)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:131)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:412)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
        at javax.media.opengl.GLCanvas.paint(GLCanvas.java:277)
        at sun.awt.RepaintArea.paintComponent(RepaintArea.java:248)
        at sun.awt.RepaintArea.paint(RepaintArea.java:224)
        at sun.awt.windows.WComponentPeer.handleEvent(WComponentPeer.java:301)
        at java.awt.Component.dispatchEventImpl(Component.java:4489)
        at java.awt.Component.dispatchEvent(Component.java:4243)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
javax.media.opengl.GLException: java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at javax.media.opengl.Threading.invokeOnOpenGLThread(Threading.java:271)
        at javax.media.opengl.GLCanvas.maybeDoSingleThreadedWorkaround(GLCanvas.java:410)
        at javax.media.opengl.GLCanvas.display(GLCanvas.java:244)
        at org.xith3d.render.jsr231.CanvasPeerImplAWT.initRenderingImpl(CanvasPeerImplAWT.java:754)
        at org.xith3d.render.DefaultRenderer.doRender(DefaultRenderer.java:494)
        at org.xith3d.render.DefaultRenderer.renderOnceInternal(DefaultRenderer.java:657)
        at org.xith3d.render.DefaultRenderer.renderOnce(DefaultRenderer.java:783)
        at org.xith3d.base.Xith3DEnvironment.render(Xith3DEnvironment.java:440)
        at org.xith3d.loop.RenderLoop.renderNextFrame(RenderLoop.java:619)
        at org.xith3d.loop.RenderLoop.loopIteration(RenderLoop.java:642)
        at org.xith3d.loop.RenderLoop.update(RenderLoop.java:698)
        at org.xith3d.loop.UpdatingThread.nextIteration(UpdatingThread.java:473)
        at org.xith3d.loop.RenderLoop.nextIteration(RenderLoop.java:709)
        at org.xith3d.loop.RenderLoop.loop(RenderLoop.java:762)
        at org.xith3d.loop.UpdatingThread.run(UpdatingThread.java:526)
        at org.xith3d.loop.RenderLoop.run(RenderLoop.java:785)
        at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassCastException: java.nio.DirectByteBuffer cannot be cast to com.sun.opengl.impl.windows.JAWT_Win32DrawingSurfaceInfo
        at com.sun.opengl.impl.windows.WindowsOnscreenGLDrawable.lockSurface(WindowsOnscreenGLDrawable.java:189)
        at com.sun.opengl.impl.windows.WindowsOnscreenGLContext.makeCurrentImpl(WindowsOnscreenGLContext.java:57)
        at com.sun.opengl.impl.GLContextImpl.makeCurrent(GLContextImpl.java:134)
        at com.sun.opengl.impl.GLDrawableHelper.invokeGL(GLDrawableHelper.java:182)
        at javax.media.opengl.GLCanvas$DisplayOnEventDispatchThreadAction.run(GLCanvas.java:452)
        at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:199)
        at java.awt.EventQueue.dispatchEvent(EventQueue.java:597)
        at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:273)
        at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:183)
        at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:173)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:168)
        at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:160)
        at java.awt.EventDispatchThread.run(EventDispatchThread.java:121)
Thanks!

Offline Marvin Fröhlich

  • Xith Lord
  • Administrator
  • Guru
  • *****
  • Posts: 4416
  • May the 4th, be with you...
    • View Profile
Re: javax.media.opengl.GLException
« Reply #1 on: 18. June 2008, 07:44:56 PM »
Hmm... Is it possible, that you have some JOGL/gluegen libs in your jre ext folder? It looks like there are concurring library versions in your classpath. If you have, please remove all additional libraries from this folder. All necessary libs are in the xith repository and are automatically included in the classpath.

Did you also try LWJGL (not LWJGL_AWT!)?

Marvin

Offline jmoliere

  • Enjoying the stay
  • *
  • Posts: 29
    • AOL Instant Messenger - Molamini
    • View Profile
Re: javax.media.opengl.GLException
« Reply #2 on: 19. June 2008, 06:30:14 PM »
Marvin,
I did have to uninstall Java3D but I still haven't had success.  Could there be a setting in the Video card that fails causing this exception?

Thanks!

Offline Marvin Fröhlich

  • Xith Lord
  • Administrator
  • Guru
  • *****
  • Posts: 4416
  • May the 4th, be with you...
    • View Profile
Re: javax.media.opengl.GLException
« Reply #3 on: 19. June 2008, 07:50:35 PM »
I wouldn't know of any. But again the question: Did you try LWJGL?

And some other questions: What kind of graphics card do you have? Which driver version is installed? Which Java version do you use? And could you please list all files contained in the JRE_FOLDER/lib/ext and JRE_FOLDER/bin folders?

Marvin

Offline jmoliere

  • Enjoying the stay
  • *
  • Posts: 29
    • AOL Instant Messenger - Molamini
    • View Profile
Re: javax.media.opengl.GLException
« Reply #4 on: 19. June 2008, 09:49:45 PM »
Marvin,
I'm developing with 3 others and they would like to know if there is a compelling reason for LWJGL?

We are basically using Nvidia.  We have tried ATI, VMWare drivers for XP (not ready for 3D yet) on a Linux box, and Intel's generic (motherboard) video card.  These cards have failed in one way or another.  My colleagues are having success with their Windows boxes so this has become a smaller issue.  We have not seen the dll from the third-party directory work -- they downloaded either a previous version of jogl or an alpha version from the JOGL website.

The jar files are...
find . -name "*.jar" -print
./lwjgl.jar
./cglib.jar
./hibernate3.jar
./jogl.jar
./ext/appframework-1.0.3.jar
./ext/junit-4.1.jar
./ext/beansbinding-1.2.1.jar
./ext/AbsoluteLayout.jar
./ext/org-netbeans-modules-java-j2seplatform-probe.jar
./ext/swing-worker-1.1.jar
./ext/javac-impl.jar
./ext/javac-api.jar
./ext/junit-3.8.2.jar
./ehcache-1.2.3.jar
./stax-1.2.0.jar
./openmali.jar
./xstream-1.2.1.jar
./appframework-1.0.3.jar
./xith3d.jar
./vecmath.jar
./commons-collections-2.1.1.jar
./vorbis.jar
./hial.jar
./stax-api.jar
./gluegen-rt.jar
./gmt-fusion-common-0.0.1-SNAPSHOT.jar
./joal.jar
./jinput.jar
./AbsoluteLayout.jar
./j3dcore.jar
./datarepo-common-1.0-SNAPSHOT.jar
./aida-3.3.jar
./datarepo-core-1.0-SNAPSHOT.jar
./swing-worker-1.1.jar
./jbossall-client.jar
./dom4j-1.6.1.jar
./commons-beanutils-1.8.0-BETA.jar
./xpal-joode.jar
./jops.jar
./spring.jar
./j3dutils.jar
./jagatoo.jar
./log4j-1.2.11.jar
./antlr-2.7.6.jar
./swt.jar
./mysql-connector-java-5.0.4.jar
./jdom.jar
./commons-logging-1.0.4.jar
./jibx-run.jar
./jmt-base.jar
./joode.jar
./aida-test-3.3.0-3.jar
./aida-dev-3.3.jar


The DLLs are...
find . -name "*.dll" -print
./wrap_oal.dll
./jogl.dll
./OpenAL32.dll
./jogl_cg.dll
./jogl_awt.dll
./gluegen-rt.dll
./joal_native.dll

Offline Marvin Fröhlich

  • Xith Lord
  • Administrator
  • Guru
  • *****
  • Posts: 4416
  • May the 4th, be with you...
    • View Profile
Re: javax.media.opengl.GLException
« Reply #5 on: 19. June 2008, 10:34:46 PM »
I'm developing with 3 others and they would like to know if there is a compelling reason for LWJGL?

Yes, there is. LWJGL is a lot faster and as much stabler input handling. That should be everything, that differs.

The reason, why I am asknig you to try LWJGL at this time is, that it uses different natives. And I was assuming, that you only copied the JOGL natives to the lib/ext folder. Unfortunately I copied EVERYTHING to lib/ext, which you really should never do. Please delete the following libraries from lib/ext:
Code: [Select]
./lwjgl.jar
./cglib.jar
./jogl.jar
./ext/junit-4.1.jar
./ext/junit-3.8.2.jar
./stax-1.2.0.jar
./openmali.jar
./xstream-1.2.1.jar
./xith3d.jar
./vecmath.jar
./commons-collections-2.1.1.jar
./vorbis.jar
./hial.jar
./stax-api.jar
./gluegen-rt.jar
./joal.jar
./jinput.jar
./j3dcore.jar
./commons-beanutils-1.8.0-BETA.jar
./xpal-joode.jar
./jops.jar
./j3dutils.jar
./jagatoo.jar
./log4j-1.2.11.jar
./swt.jar
./mysql-connector-java-5.0.4.jar
./jdom.jar
./commons-logging-1.0.4.jar
./jibx-run.jar
./jmt-base.jar
./joode.jar

And the following dlls from bin:
Code: [Select]
./wrap_oal.dll
./jogl.dll
./OpenAL32.dll
./jogl_cg.dll
./jogl_awt.dll
./gluegen-rt.dll
./joal_native.dll
(Which are all).

You really don't need these jres/dlls in these system folders. They reside in the repository (with the correct/matching version). If you're using Eclipse, NetBeans or the ant scripts the required jars and natives are automatically included by the projects. All you need to do on Windows when using Eclipse, is to modify the project's classpath to use Windows natives instead of the linux ones.

Copying jars and dlls to the System's Java folder is bad for some reasons: You cannot use two versions of the same library (e.g. in two different projects) at a time. Especially Java WebStarts will cause problems for this reason. There are other secondary reasons, that all root in this reason. So, please never do this.

One thing, that is strange, is that you seem to be using linux tools (like "find") and use slashes, but have dlls in your bin folder. Shouldn't there be .so files?

We are basically using Nvidia.  We have tried ATI, VMWare drivers for XP (not ready for 3D yet) on a Linux box, and Intel's generic (motherboard) video card.  These cards have failed in one way or another.  My colleagues are having success with their Windows boxes so this has become a smaller issue.  We have not seen the dll from the third-party directory work -- they downloaded either a previous version of jogl or an alpha version from the JOGL website.

There are some known problems with ATI and Intel cards, that should be worked around internally by xith. But maybe there are others, that have not yet been discovered AND reported to me and I therefore haven't coded a workaround for them. Sometimes it helps to install omega-drivers. ATI doesn't seem to be able to create good drivers on their own.

NVIDIA definitely causes the least problems. Drivers are good on both Linux and Windows.

Marvin

Offline Marvin Fröhlich

  • Xith Lord
  • Administrator
  • Guru
  • *****
  • Posts: 4416
  • May the 4th, be with you...
    • View Profile
Re: javax.media.opengl.GLException
« Reply #6 on: 19. June 2008, 10:40:40 PM »
One more word: In eclipse you can simply link your own project to the xith3d project and don't need to add all the libraries and natives to you own project, since they are inherited from the xith3d project. I assume, this is possible in NetBeans, too, but I don't know.

Marvin