We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › Using different graphic backends outside PDE
Page Index Toggle Pages: 1
Using different graphic backends outside PDE (Read 2394 times)
Using different graphic backends outside PDE
Sep 18th, 2009, 6:00am
 
Hi,

I'm struggling to use an external IDE (Netbeans). I managed to get most parts working (core + some external libs), but I'm running into problems with the different graphic backends.

The examples I found all use the default (JAVA2D) engine, which seems to work. When I try to run OPENGL or P3D I get into trouble. I've added all the libraries from Processing to my project, but this doesn't seem to help.

When using P3D:

Exception in thread "Animation Thread" java.lang.NullPointerException
       at waveformnm.Main.draw(Main.java:107)
       at processing.core.PApplet.handleDraw(PApplet.java:1425)
       at processing.core.PApplet.run(PApplet.java:1327)
       at java.lang.Thread.run(Thread.java:637)



When using OPENGL:

Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
       at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1812)
       at java.lang.Runtime.loadLibrary0(Runtime.java:823)
       at java.lang.System.loadLibrary(System.java:1045)
       at com.sun.opengl.impl.NativeLibLoader.loadLibraryInternal(NativeLibLoader.java:189
)
       at com.sun.opengl.impl.NativeLibLoader.access$000(NativeLibLoader.java:49)
       at com.sun.opengl.impl.NativeLibLoader$DefaultAction.loadLibrary(NativeLibLoader.ja
va:80)
       at com.sun.opengl.impl.NativeLibLoader.loadLibrary(NativeLibLoader.java:103)
       at com.sun.opengl.impl.NativeLibLoader.access$200(NativeLibLoader.java:49)
       at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLibLoader.java:111)
       at java.security.AccessController.doPrivileged(Native Method)
       at com.sun.opengl.impl.NativeLibLoader.loadCore(NativeLibLoader.java:109)
       at com.sun.opengl.impl.macosx.MacOSXGLDrawableFactory.<clinit>(MacOSXGLDrawableFact
ory.java:53)
       at java.lang.Class.forName0(Native Method)
       at java.lang.Class.forName(Class.java:169)
       at javax.media.opengl.GLDrawableFactory.getFactory(GLDrawableFactory.java:108)
       at processing.opengl.PGraphicsOpenGL.allocate(PGraphicsOpenGL.java:172)
       at processing.core.PGraphics3D.setSize(PGraphics3D.java:316)
       at processing.core.PApplet.makeGraphics(PApplet.java:1164)
       at processing.core.PApplet.size(PApplet.java:998)
       at processing.core.PApplet.size(PApplet.java:958)
       at waveformnm.Main.setup(Main.java:60)
       at processing.core.PApplet.handleDraw(PApplet.java:1402)
       at processing.core.PApplet.run(PApplet.java:1327)
       at java.lang.Thread.run(Thread.java:637)



What steps to I need to take in order to make an external IDE play nice with all of Processing standard libraries?

It's a bit of a hassle to set up an external IDE, but I really need it. Once I have everything up and running I plan to put all the dependencies in a Maven repository...



Re: Using different graphic backends outside PDE
Reply #1 - Sep 18th, 2009, 8:54am
 
I'm using Eclipse, but Netbeans should be more or less the same.

So for Eclipse:

Step 1.
First, you have to add all the jars you need to your build path.

Go to the Project->Properties Menu, and open "Java Build Path/Libraries"

Click on Add External jars, navigate to your processing/libraries/opengl/library Folder, and select the jar files you need. Take special notice of the libraries named xxxx-natives-xxxx.jar: you only need the ones for your system.

So far so good, in a normal Java programm you would be done. But OpenGL uses some native code, so you need an extra step:

Step 2.
Once you are done adding the jars, you have to tell them where the native libraries are: look in the list of jars in "Java Build Path/Libraries", and find the ones marked as native.
I have 2 (but this may be different depending on your system):
jogl-natives-linux-i536.jar and gluegen-rt-natives-linux-i536.jar
In eclipse i.e., you can then expand the jar entry. It looks like this

jogl-natives-linux-i536.jar
-- Source Attachment (None)
-- Javadoc Location (None)
-- Native Library Location (None)

Select "Native Library location" and click on Edit->External Folder.
Navigate to processing/libraries/opengl/library

yuhuu done

Re: Using different graphic backends outside PDE
Reply #2 - Sep 21st, 2009, 2:00pm
 
There seems to be no easy way to set java.library.path in Netbeans like you described for Eclipse. Currently I'm setting this path by launching my jar from the command line.

I'm on OSX 10.5.8 and I don't know whether I should use the opengl library or library64 folder. I don't understand why the library64 has no jnilib files. What is the reason for this and which libraries am I supposed to use?

If I point to the "library" folder I get a memory error, something like:
Invalid memory access of location 0x0 rip=0x7fff828289cd

If I point to the "library64" I get the same "no jogl in java.library.path" Java error. I tried copying the jnilib files from library to library64, but then I get the same Invalid memory access error.

I am using Java 1.6.0, might this cause problems?

Maybe I should move this question to the OpenGL part of the forum...

Re: Using different graphic backends outside PDE
Reply #3 - Sep 22nd, 2009, 5:51am
 
There's an active discussion on using opengl with eclipse in the "integration" part of the forum. here: http://processing.org/discourse/yabb2/num_1114400513_30.html#34
maybe somebody can help you with Netbeans there. I will give Netbeans a ride when I have the time.
Re: Using different graphic backends outside PDE
Reply #4 - Sep 25th, 2009, 3:58am
 
To set java.library.path in Netbeans:
  • Go to File > Project Properties.
  • Select 'Run' in the tree on the left.
  • In 'VM Options', type "-Djava.library.path=/path/to/lib" (without the quotes)

I hope that helps.
Page Index Toggle Pages: 1