Use of swing and JOGL components (GLJPanel and GLCanvas) (??)

I’m a new java user but I’ve had a little experience in OpenGL in C++. I’m trying to develop a Java application ussing NetBeans 6.0 and added a plug-in “net-java-nboglpack-updatecenter.nbm” and GLJCanvas and GLCanvas in the IDE’s palette.

I try to add the GLJPanel and GLCanvas but when I try to design an interface ussing swing components, the system show some errors. What I have to do (add inicialization rutines) ?
Can somebody help me with this issue?
I’ll appreciate your help.

hi gekko08,

If I understood you correctly you have installed the OpenGL Pack Update center and added the JOGL gui components manually to the palette, is that correct?
The update center is actually nothing more as a url to the download location of the NetBeans OpenGL Pack.

Please follow the install instructions to download the modules you require (e.g the JOGL Form Designer module) or download all modules as zip archive and install them with the plugin manager.

edit:
Since you said you are new in java I recommend to install the demo projects module too (or simple all modules :wink: ). It contains a project template and around 100 ready to run demos (including the ported Red Book samples).

The installation consists on just setting the classpath in your system. After that, when you are developing with JOGL in NetBeans, you have to add JOGL and GLUEGEN to your project(this is what i have to do in my system). Just go to the Project Panel and “Libraries->AddJar/Folder” (the first time) or “Libraries->Add Library” and select JOGL and GLUEGEN.

Enjoy!

http://www.raul-art.blogspot.com

Thank you very much for your answers. Let me say that I’ve installed the plugins for OpenGL correctly, (i supossed that since “Intalled” show them), I can see the GUIs in the palette but mi problem is that i don’t know how use them.

I’m interested in develop an interface whit the GLCanvas (or GLJPane instead) whit some swing components, some buttons and textLabels but I don’t know what i’ve to do to initializa the JOGL components and where can I add my code to generate 3d figures.

I’d appreciate your advices.

the problem is probably (RaulHuertas said it already) that JOGL and GLUEGEN aren’t inside your project’s classpath. The JOGL palette items can’t add the jars to your classpath because it is currently not possible to do that platform agnostic (JOGL’s native libs are the problem…)

To keep a long sorry short just start with a sample project (eg. the “Simple JOGL Application”) and add a JFrame to it (the build script handles the JOGL deployment for you, so please build first) now you should be able to use the components of the palette without the errors you mentioned.

If not something went wrong and you hit probably a bug (in this case please provide the exception text)

I checked and modify the Enviromental Variables - CLASSPATH- I add the path for jogl.jar and fluefen-rt.jar. Then I add the paths and libraries to mi project (JOGL and GLUEGEN), after this I instert a new JForm and compile my project without errors, but when I add a GLJPane the compiler shows:
“Exception in thread “AWT-EventQueue-0” java.lang.UnsatisfiedLinkError: no jogl in java.library.path”

What could be the problem? Tank you for your assistance, again.

please do not modify your environment variables, java programs should be platform independent you don’t have to configure your platform to run your apps.

If you start a new project please use the “Simple JOGL Application” project (File | New Project… | OpenGL section) the build script will handle the cross platform JOGL deployment for you and provide a minimal OpenGL application for a easy start.

If you have a existing project and want to use JOGL do the following:
-copy jogl.jar and gluegen-rt.jar into your project (e.g myproject/lib)
-extract jogl-natives-[your system].jar and gluegen-natives-[your system].jar into the lib folder
-right click on your project > Properties > Libraries
-press “add Jar/Folder” and add jogl.jar and gluegen-rt.jar to the classpath

now you may start hacking or designing, everything should compile but it won’t run yet

-select the combo box on top of the IDE and select customize
-select “Run” and add -Djava.library.path=“lib” to the VM options (this adds the native libraries to the library path of the VM if you run your app)

just hit run and hope for the best :wink:

edit: added a screenshot

http://people.fh-landshut.de/~mbien/classpath.png

I’ve installed the NetBeans OpenGL Pack and updated the available plugins, at the moment I can run the “SimpleOGL Applications” without problems, but when I start a new project and perform the previous steps, except for the copy gluegeen-natives 'cause I can not find the file. I can add a GLJPane into a JFrame and compiled it without problems, but when I try to run the file (form) I still have the diagnostic “Exception in thread “AWT-EventQueue-0” java.lang.UnsatisfiedLinkError: no jogl in java.library.path”. ??? There is another way to check if I’ve installed the libraries correctly ?

Best regards

[quote=“gekko08,post:8,topic:31427”]

have you done that?

edit:
do not “right click” > run, use the “play” button on top of the IDE

java.library.path errors are caused when the JVM don find the dll libraries on WIndows, or .so libraries on UNIX systems. In Linux you can modify LD_LIBRARY_PATH. In both platforms add the *.so to [your-jdk-path]/jre/ext/i386 , but as bienator says this is not recommended, you may not have access to this files.

I had the same problem than you at the beginnin. In fact, I still have it!. I use Linux. What I do is, instead of making click in the icon installed with the NetBeans-Installer, I type in the bash shell:

$./[myNetbeanFolder]/bin/netbeans

I’m not a linux bash expert so I can’t solve this problem in a better way.

Bye!

I re-installed the IDE and the Plugins again, I follow your recomendations and I could compile and run the simpleOGL_Example and a simple JavaApplication with GLJPane.

Thank you !!