OpenGL in Processing using Eclipse

You want to do it. It’s going to make your life easier, especially if you’re doing something big. There are steps up on the Processing site but I think these courtesy of the processing forum user ‘letsgooutside’, are much easier. Here are the steps to follow:

1. Make a new Java project
2. Add a new folder to the project root named “lib” or “X” or whatever
3. Add a new folder inside of “lib” called “natives” or again, whatever
4. Right-click on your “lib” folder and choose “Import”.
5. Browse to your “Processing\lib” folder and import the following file so that your application has access to

– core.jar

6. Right-click on your “lib” folder and choose “Import”.
7. Browse to your “Processing\libraries\opengl\library” folder and import the following files:

– gluegen-rt.jar
– jogl.jar
– opengl.jar

8. Right-click on your “natives” (which is inside your “lib” folder) and choose “Import”.
9. Browse to your “Processing\libraries\opengl\library” folder and import *ALL* files, *EXCEPT* the following:

– gluegen-rt.jar
– jogl.jar
– opengl.jar

10. WINDOWS: In your project’s “lib” folder, right-click “gluegen-rt.jar” and choose “Properties”.
OSX: At your project root select “Build Path” and then “Configure Build Path”. Select gluegen-rt.
11. Under “Native Library”, click “Workspace” and browse to “YourProjectName/lib/opengl-natives” and click “OK”.
12. WINDOWS: In your project’s “lib” folder, right-click “jogl.jar” and choose “Properties”.
OSX: At your project root select “Build Path” and then “Configure Build Path”. Select “jogl.jar”.
13. Under “Native Library”, click “Workspace” and browse to “YourProjectName/lib/opengl-natives” and click “OK”.

It should look like this:
Build Props

14. Run this as your main class:

import processing.core.*;
import processing.opengl.*;
import javax.media.opengl.GL;
public class Test extends PApplet
{
    public void setup()
    {
         size(800, 600, OPENGL);
    }
}

The key things to note here are that your core JAR files are *not* in the same folder as their respective natives, and that, and for Windows, the DLL files absolutely must be in with these natives.

Leave a Reply