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 › openGL end Eclipse problems
Page Index Toggle Pages: 1
openGL end Eclipse problems (Read 1803 times)
openGL end Eclipse problems
Sep 26th, 2007, 11:18pm
 
I'm trying to make the jump to eclipse, but openGL is giving me some strange problems. The same code acts differently in processing and eclipse.
When the sketch is running from eclipse it makes strange stops, especially when the mouse is over the sketch. Also openGL from eclipse is not fast, actually when I use PFont at the same time it seems slower.
The thing is I'm not sure openGL is running at all, maybe only P3D or something because I don't need to import openGL in my eclipse sketch, but I need to have jogl.jar in my reference libraries.

I do have -Djava.library.path="C:\programmer\processing\libraries\opengl\library"
in my VM arguments

And I don't get any regular warnings when it's running but when I'm switching back and forth from eclipse and processing testing this issue I sometimes get a bug (I haven't reported...sorry).

Here is and example with eclipse and processing code:


eclipse code:

package digitalDecay;

import processing.core.*;

@SuppressWarnings("serial")
public class TestText extends PApplet {

 final int WIDTH = 300;
 final int HEIGHT = 200;

 int rotate = 0;
 int num = 70;

 public void setup() {
   size(WIDTH, HEIGHT, OPENGL);
 }

 public void draw() {
   background(150);
   fill(255);
   translate(WIDTH / 2, HEIGHT / 2);
   rotate(radians(rotate));
   for (int i = 0; i < num; i++) {
     for (int j = 0; j < num; j++) {
       ellipse(i * WIDTH / num - WIDTH / 2,
               j * WIDTH / num - WIDTH / 2,
               5, 5);
     }
   }

   rotate++;
 }
}


processing code:

import processing.opengl.*;

final int WIDTH = 300;
final int HEIGHT = 200;

int rotate = 0;
int num = 70;

void setup() {
 size(WIDTH, HEIGHT, OPENGL);
}

void draw() {
 background(150);
 fill(255);
 translate(WIDTH / 2, HEIGHT / 2);
 rotate(radians(rotate));
 for (int i = 0; i < num; i++) {
   for (int j = 0; j < num; j++) {
     ellipse(i * WIDTH / num - WIDTH / 2,
             j * WIDTH / num - WIDTH / 2,
             5, 5);
   }
 }

 rotate++;
}

I've had problems with openGL before with smooth(), but that's a graphic card or driver problem, this is different because in processing there isn't any problems.

Does anyone have an idea what the problem is. I've been trying for days and I really don't have any idea.
Re: openGL end Eclipse problems
Reply #1 - Sep 27th, 2007, 12:10am
 
In eclipse you're probably using Java 1.5 or 1.6, while Processing IDE comes with 1.4.

Read here why it's best to use 1.4 with processing and why it's faster:
http://processing.org/reference/environment/platforms.html#java

You can change the JRE used for your eclipse project by selecting it on the JRE tab in your launch configuration:
Project->Properties->Run/Debug Settings->(select your launch config)-> Edit...->JRE
Re: openGL end Eclipse problems
Reply #2 - Oct 1st, 2007, 10:26am
 
Thanks for the help.

It made openGL faster and cleared the problems switching from processing to eclipse, but didn't help with the skipping issues though.

P3D doesn't skip by the way, only openGL.
Re: openGL end Eclipse problems
Reply #3 - Oct 2nd, 2007, 10:26am
 
Can anybody at least tell me if it's a bug or me who is doing something wrong?

Turns out JBuilder does the same thing.
Re: openGL end Eclipse problems
Reply #4 - Oct 2nd, 2007, 2:18pm
 
hi,

i just tested your code. it runs slow both in processing and eclipse (drawing 4900 ellipses is slow, nothing you can do about that Wink)
However, I don't see any (irregular) skipping in eclipse and processing.

another thing you could try... go to your project properties-> Java Complier -> Compiler compliance level: 1.4
But actually I'm not sure how these two settings (compiler compliance and JRE setting) affect the sketch. These are just the settings that worked best for me.

Have you tried to write a sketch that actually CAN reach the desired frameRate? Standard framerate is 60. My machine renders your example with max. 10fps. Does the skipping appear when you set the frameRate() to 10 or if you draw way less ellipses? (my machine makes 60fps up to num=25)
Re: openGL end Eclipse problems
Reply #5 - Oct 2nd, 2007, 4:06pm
 
I know it's slow in both eclipse and processing, I just tried to make some simple example I could run with and without openGL to see the difference in both programs.
So it's not a problem it's slow, the problem is the skipping. Maybe skipping is the wrong word. The program stops for 2-10 seconds, and then starts again, then stops again at random or if I move the cursor over the sketch.
If I change rotate to rotateZ so I have to use P3D the problem is the same. No problems with P3D but with openGL it stops.

I have already changed the compiler setting, and it didn't work.
Re: openGL end Eclipse problems
Reply #6 - Oct 4th, 2007, 1:08pm
 
hmmmm updated my drivers and now it works like a charm. Smiley

Sorry to have wasted your time and thanks a lot for the help.
Re: openGL end Eclipse problems
Reply #7 - Dec 14th, 2007, 9:30pm
 
I finally was able to get Eclipse, Processing and Opengl to work.

Project->Properties->Java Build Path
Select the "Libraries" tab
Click "Add External JARs"
Navigate to the proecessing application folder...added these JARs
lib/core.jar,
libraries/opengl/library/opengl.jar, jogl.jar, gluegen-rt.jar.

Select the Source tab
Click "Add Folder"
Click "Create New Folder"
Folder name...put in "lib"
Click "Advanced"
Check "Link to folder in the files system"
Browse to libraries/opengl/library

Now it should work.

However, I'm still getting these error messages:
2007-12-14 15:29:33.884 java[26406] CFLog (0): CFMessagePort: bootstrap_register(): failed 1103 (0x44f), port = 0xe503, name = 'java.ServiceProvider'
See /usr/include/servers/bootstrap_defs.h for the error codes.
2007-12-14 15:29:33.897 java[26406] CFLog (99): CFMessagePortCreateLocal(): failed to name Mach port (java.ServiceProvider)
java[26406]: [WSX:SUIS[244]] error loading prefs - creating defaults one
Re: openGL end Eclipse problems
Reply #8 - Dec 14th, 2007, 11:28pm
 
These error appears when you start two applets or application in eclipse or you have an applet started from processing and then start one in eclipse.
Page Index Toggle Pages: 1