frameRate

edited April 2014 in Using Processing

Hi there,

I have a very simple Processing sketch, I'm on a mac, 2.66 GHz Intel Core 2 Duo, 4 GB ram, osx 10.9.2, running Java JDK 8.

Running this simple sketch:

public void setup() {
    size(displayWidth, displayHeight);
    background(0);
    stroke(255);
}

public void draw() {
    background(0);
    line(0, 0, random(width), random(height));
    text(frameRate, 200, 200);
}

I get a framerate of approx 20. I feel like that's very slow? Any suggestions why that might be?

Tagged:

Answers

  • I also got 20fps but when I changed line 2 to

    size(800,600);

    I got the expected 60fps. Must be something to do with drawing to full screen.

  • Try this:

    public void setup() {
    
       size(displayWidth, displayHeight);
       frameRate(60);
    }
    
    public void draw() {
    
       background(0);
       stroke(255);
       line(0, 0, random(width), random(height));
       text(frameRate, 200, 200);
    }
    

    I advice you to set the background color in draw(). Also, for better organization, move the stroke(255) setting next to line(...). Try it and see if it got any better.

  • @quark Not really. At mine, it worked at 60 fps at fullscreen and I have a Dell Inspiron 15, so compared to Mac...

  • Got full 1920x1080 @ 60 FPS here too! >-)

  • Answer ✓

    On a quad i7 Mac Mini I get about 30 fps in Processing 2.1.1 and about 60 fps in 2.0.3. I've seen even greater slowdowns in some of my own sketches. I don't have my Linux machine up right now, so I can't test yours there, but my sketches don't slow down there. The Linux machine uses the same Intel HD 4000 graphics processor as the Mac.

  • I confess: I'm still using P v2.0.2! And am on Linux too! o->

  • I haven't tested yet, but will see what happens if I get an older version of Processing. I tested some of my older sketches before I update, and they where also all slower, so seems to be something odd with the update.

  • Ok, so now I actually reverted back to P v2.0.2 and the issue is solved, I have a frameRate of 60 on a fullscreen sketch. So seems there is something fishy about the latest version?

  • So, I have done some further testing: It was not the Processing version that was the problem, but rather which version of the Java JDK that is running. When I'm running Java 1.6, there are no issues, and the frame rate is high, actually when setting frame rate: frameRate(1000), I get frame rates as high as 180, but on Java 1.8 I never get any higher than 20 when in fullscreen.

  • I'm forcing Processing v2.0.2 to use my system's installed 64-bit OpenJDK 7! :D

Sign In or Register to comment.