GLCanvas not working anymore, GLJPanel works fine... why?

hello, i’ve been developing my simple JOGL app for some time now, and all of a sudden it just stopped working properly.
i’ve been using GLCanvas for drawing, but suddenly my app began to raise exceptions while run, like this:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.IllegalArgumentException: argument type mismatch... [and a lot more]

i am not using any multithreading things, its just a simple JOGL+Swing app. after making some minor modifications to my code, and after some update (in netbeans, i think it was the openglpack update) my app broke down.

i tried a lot of things, and have no idea what is the root of this problem.

i’ve just tested my app with GLJPanel instead of GLCanvas, and it works just fine.

any ideas?

You have a mismatched jogl.jar and jogl.dll.

Make a clean build of your project (using the hammer and brush symbol). Please report if this helps.

thanks for your quick replies.
anyway, yes, i’m using clean build, but with no luck.
and about mismatched jogl.dll and jogl.jar… well, i have replaced all occurences of those files in my system with new ones from jogl-1.1.1-rc8-windows-i586.zip file, but still nothing.

GLJPanel works, GLCanvas doesn’t.

full output:

Exception in thread "AWT-EventQueue-0" java.lang.RuntimeException: java.lang.IllegalArgumentException: argument type mismatch
        at com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.newPlatformInfo(JAWT_DrawingSurfaceInfo.java:86)
        at com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.platformInfo(JAWT_DrawingSurfaceInfo.java:52)
        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)
Caused by: java.lang.IllegalArgumentException: argument type mismatch
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at com.sun.opengl.impl.JAWT_DrawingSurfaceInfo.newPlatformInfo(JAWT_DrawingSurfaceInfo.java:83)
        ... 20 more

btw: what is the best way to keep clean with those jogl files, to avoid future conflicts, and version problems?
i was using openglpack for netbeans for automatic installation, but something went wrong, and it doesn’t work anymore… well, maybe it works, but with the above problems.

Please remove any occurences of jogl.jar, gluegen-rt.jar, jogl.dll and gluegen-rt.dll fom any directory that is in your path and from any JDK or JRE installation and try again. Be sure not to touch the ones under “.netbeans\6.0\jogl-runtime”. We recently had to change the way, jogl was deployed in netbeans, so this could be a bug, if it still doesn’t work after the cleanup :confused:

Just keep jogl/gluegen out of your JDK/JRE and you should be safe. The OpenGL pack manages it’s own copy of the jogl files, so you (normally) don’t need to do anything…

okay… thanks, i’ll try that later today.
and what about deploying app on other machines?

i’ve copied all contents of dist dir (myApp.jar + lib dir containing all needed jars) into target machine, but it just doesn’t run at all.
when i run in console i get java.lang.NoClassDefFoundError, so obviously, i’m doing something wrong. [but this is offtopic]

should work, if you also copy the natives (should be in dist). You should be able to start the app via java -jar myApp.jar on the console. If you still have problems, please make a clean build and send me a zip of your project including the dist folders to cylab (at) highteq (dot) net.

[quote]should work, if you also copy the natives
[/quote]
thanks for the tip :slight_smile: it turned out that there were no native libs in the lib directory of my project (i don’t know why, only jars were there).
i have put the dlls in the lib dir, and now my app runs (with the -jar option which you specified, thanks) with -Djava.library.path=./lib option.

so now we can get back to the real problem:
my app runs now, but with errors, like this:

javax.media.opengl.GLException: Error making context current

i think that my problem might be thread\context related.
i don’t have any thread control code inside my app.

Actually on windows, the plugin should copy the dlls besides your app.jar to the dist-folder, so the app can be started without specifying -Djava.library.path. If it doesn’t, this could be a bug (or you have enabled webstart for the project!?). Either way, you should have platform specific dist-folders containing the natives.

If you don’t do anything thread related, this could be a driver bug. What card do you have?

i have radeon 9000 on my laptop (Dell D600). problem is, everything was going good, my app was working properly, when suddenly this problem arised.

it all began, when i tried to update jogl libs through opengl pack installer (update center) in netbeans (as far as i remember, i’m not sure now).

so, i assume that this is lib-related problem.

furthermore, when i removed jogl from netbeans, and tried to install it again, it didn’t install (because of errors).
strange.

Do you have solved this, yet?

not yet, i have tried a lot of things, but with no luck.
i’ve noticed few things:
when i import NBOGLpack update center into netbeans, and then install ONE of the plugins, and then (after IDE restart) try to install some other plugin from opengl branch it says: proxy error… i have completely no idea why.
BUT
when i install all of plugins from opengl branch (clean install) then it’s OK

also,
GLJPanel works.
GLCanvas doesn’t.

so i think there’s something wrong with openglpack itself, openglpack-to-netbeans bindings, libs, or just the installer.

you have always the option to download the ziped modules and install them directly with the plugin manager if you experience proxy problems.

What happened if you used the GLCanvas?
If you tried to put the heavyweight canvas into a swing component with group layout, NetBeans collapses the canvas into 1x1pixels for some reasons. But resizing works for me…

I have tested the pack on ubuntu and winxp i586/amd64 and it worked fine for me.

The only thing I can imagine is that you still have native libs somewhere in the JRE/JDKs library path or accidentally replaced the natives of the jogl-runtime folder with mismatched natives (e.g without updating the jar).
If so, make sure that you remove the .netbeans/6.0/jogl-runtime folder next time you uninstall the opengl pack (if it is not removed automatically).

[quote]you have always the option to download the ziped modules and install them directly with the plugin manager if you experience proxy problems.
[/quote]
yes, i’ve done it already. the thing is, i think it’s not proxy related at all. anyway, i’ve also tried to install through downloading full zipped modules.

[quote]What happened if you used the GLCanvas?
[/quote]
i already had canvas in my frame, so it had proper size (indeed, in the beginning it was resized to 1x1… confusing). so, resizing works for me too.

[quote]I have tested the pack on ubuntu and winxp i586/amd64 and it worked fine for me.
[/quote]
yes, in general, it works. but there are some exceptions. anyway, i managed to install it. that’s not the main problem.

[quote]The only thing I can imagine is that you still have native libs somewhere in the JRE/JDKs library path
[/quote]
before installing opengl pack, i have uninstalled it, and removed all occurences of jogl.jar, jogl.dll, gluegen-rt.jar, gluegen-rt.dll, and anything else what had jogl in the name.
so, i think my system was relatively clean.

so still, GLJPanel works, and GLCanvas doesn’t.

that’s fine, i can switch to GLJPanel, but why GLCanvas stopped working suddenly?
(maybe i should test it with some older version of JOGL/openglpack? maybe i should remove netbeans, and everything, and try again with clean install?)

I had the exact same problem and in my case I thought I had everything correct as well, but in fact my path was not set properly…it was set to release candidate 6 but I was using the release candidate 8 jars and dlls. Definitely double/triple check your paths and other environment variables.

i have extracted jars and dlls into folder, and added it to classpath and path environment variable (windows),
but that didn’t change anything. i have used jogl-1.1.1-rc8-windows-i586.zip.
how should those variables be set?

you will have to set the classpath (-cp) to the jars and the -Djava.library.path=folder to the folder containing the natives

but maybe you want to try the new modules first I uploaded for testing:
https://netbeans-opengl-pack.dev.java.net/servlets/ProjectDocumentList?folderID=8928
I have repackaged the jogl distribution with rc8 and gluegen-rt 1.0b05 again maybe this will solve your problem.

thanks for your support.
but still nothing, i’ve tried both.

i’m really confused… maybe i’ll just uninstall netbeans, java and everything, and then install from scratch?

BUT
when i create new project -> simple jogl application (wchich contains GLCanvas) IT WORKS.

if you say it doesn’t work are you talking about the “java.lang.IllegalArgumentException: argument type mismatch” or something else?

for netbeans it is probably enough to remove or rename the folder .netbeans/6.0 this will remove all previously installed modules and config files and force clean redeployment on next start. But if you have enough bandwidth just reinstall everything if you want :wink:
Note:
-the .netbeans folder wont be removed automatically
-if you have placed jar files in the ext folder of the jre/jdk they will be still there after uninstall

i’ve tested one thing now: moved some code from my app into jogl simple app (glcanvas) and it worked.
so, glcanvas is working. good.

[quote]if you say it doesn’t work are you talking about the “java.lang.IllegalArgumentException: argument type mismatch”?
[/quote]
yes.

[quote]But if you have enough bandwidth just reinstall everything if you want
[/quote]
yeah, i did that several times. i mean not java and netbeans, but openglpack, and jogl. no luck.

[quote]-if you have placed jar files in the ext folder of the jre/jdk they will be still there after uninstall
[/quote]
i haven’t.

[quote]-the .netbeans folder wont be removed automatically
[/quote]
hmmm… and what if i removed it manually? :smiley:

edit:
ok, i’ve checked it: deleted whole .netbeans directory, and then tried to run my project again.
no luck, still “java.lang.IllegalArgumentException: argument type mismatch”…