This is something that I just spent the past 3 hours figuring out, so I thought that I would write this up so that it might prove helpful to others. It took me some quite some time to assimilate all the information I gathered across various sites, most of which were many years old, so I figured I would write it down so it could be found in one place =) I'm currently using Windows 7 32 bit, but I'm upgrading to 64 bit next week so I might make an edit if there are any major differences between the two (I don't expect any however).
First, visit http://processing.org/learning/eclipse/ to see how to get Processing in general to work with Eclipse. It's a fairly straightforward guide and shouldn't be too much trouble.
Now for the OpenGL part.
Start by navigating to
File > Import > General > File System
Browse to your processing-1.5.1 folder, and then choose the lib folder. Mark the core.jar file that's inside and hit Finish to import it.
Now go back to the processing folder, but this time instead of lib, you're going to go to
modes > java > libraries > opengl > library
Mark the three jar files inside (gluegen-rt.jar, jogl.jar, and opengl.jar) and hit Finish to import those.
Go back one more time to the opengl library as in the previous step, but this time go inside the library and choose the folder that corresponds to whatever operating system you are using. There should be four files inside, regardless of your operating system, but the file type will differ based on what you're using. However, they should be named libglugen-rt.*, libjogl_awt.*, libjogl_cg.*, and libjogl.*, with the * being the file type specific to your OS. Import these four files by hitting Finish once again.
Now you should have eight files in your Referenced Libraries folder. You now need to add them all to the build path. You can do this by right-clicking > Build Path > Add to Build Path.
Once you've added all the libraries, you need to copy the last four files you imported (The ones specific to your OS) into your src folder.
Finally, go to
Run > Run Configurations > Arguments tab > VM arguments
and add this line "-DJava.library.path=PATH TO OPENGL LIBRARY" (Without the quotes)
Change your path so that it finds the opengl library. For example, mine is
-DJava.library.path=C:\Users\Summit\Desktop\processing-1.5.1\modes\java\libraries\opengl\library\
Once you're done, hit Apply and then Close.
You're finished! Now at the top of your sketch, make sure you import openGL with
import processing.opengl.*
and in your setup() method, make sure you enable openGL by doing
size(screenWidth, screenHeight, OPENGL);
where screenWidth and screenHeight are whatever size you decide them to be.
You should now be able to run your program as a Java Applet.
Hope this has helped! Let me know if you see any errors or have any questions.