P2D now slow, even on an empty sketch, wasn't so slow before

edited February 2016 in Using Processing

Hi, This morning I could run a particle system sketch with size(displayWidth, displayHeight, P2D) at 60fps. Now, even an empty sketch (just 1 line in draw to display frameRate, size in setup with the same arguments), run around 30 fps. I install new drivers for my graphic card, reboot computer, nothing runnning behind... Any clues? Thanks!

Answers

  • edited February 2016

    Check this: https://github.com/processing/processing/wiki/Changes-in-3.0 and read up on the changes made to size() in P3. As you give no other information, such as Processing version your using, it's a "best guess" on my part. Cheers.

  • or fullScreen() ?

  • @ SiriusCG, yeah, I read it, but I didn't find real clues about what's going on. I'm using processing 3.0.1, on windows 8. @Chrisir : Same pb when I use fullScreen(), even a so dumb sketch run at 30fps :

    void setup() {
      background(0);
      fullScreen(P2D); 
      // size(displayWidth, displayHeight, P2D);
    }
    
    void draw() {
      background(0); 
      text("fps :"+frameRate, 20, 20);
    }
    
  • edited February 2016

    Your code runs at 32fps on my Win7 64bit AMD Phenom 9950 Quad core 2.3Ghz 8GB machine at 1920x1080 resolution, nVidia GT 730 card 2GB VRAM. Using Processing 3.0.1

    When I make the following changes,

    void setup() {
      background(0);
      fullScreen(); 
      // size(displayWidth, displayHeight, P2D);
    }    
    

    or

    void setup() {
      background(0);
      //fullScreen(P2D); 
      size(displayWidth, displayHeight);
    }
    

    it runs at 60+ fps. As I recall, omitting P2D or P3D in fullscreen() or size() causes P3 to fallback to it's "default" render setting:

    Processing has three primary renderers: the default renderer, P3D, and P2D. The default renderer is used for the majority of the programs in this book; it's for 2D drawing.

    So, something a bit strange with P2D it seems.

    Cheers

  • edited February 2016

    Wow, such potent machine and practically empty draw() can't reach 60 FPS! :-O
    AFaIK, OpenGL renderers like P2D & P3D don't like pixel manipulation commands like background(), set(), etc. Perhaps clear() or image() might be faster? :-/

    P.S.: Processing 3 got a new renderer: FX2D. And in the old Processing 1, P2D & P3D were non-OpenGL renderers! We'd had to use OPENGL to get OpenGL! O:-)

  • edited February 2016

    @ GoToLoop , even with clear(), this sketch still run around 30fps on my Win7 64bit 16GB computer...

    void setup() {
      size(displayWidth, displayHeight, P2D); 
      background(0);
    }
    
    void draw() {
      clear(); 
      text("fps :"+frameRate, 20, 20);
    }
    
  • In my 64-bit Win 7 AMD Phenom HD 4250 laptop, the sketch below runs @ ~60 FPS, w/ ~100 spikes! :bz

    void setup() {
      size(1920, 1080, P3D);
    }
    
    void draw() {
      clear(); 
      text("FPS :" + frameRate, width>>1, height>>1);
    }
    
  • edited February 2016

    @ GoToLoop : That's very strange. I paste your code, run it, 60fps. Change size with displayWidth, displayHeight, P2D, still 60 fps. Delete clear() and wrote background(0) in setup() and draw() (so exactly the same sketch than above), still 60fps. Open my "blank sketch" (the simple one I post above), now it's running at 60fps also. Close everything, reopen the blank sketch and make it run...30fps...Create a new sketch, paste yours (run at 60fps), make again my "blank sketch" run, and now again 60 fps...really strange...

  • edited February 2016

    I did some other tests, copying my blank sketch on a fresh windows, sometimes both was running at 60fps, but when I tried to remake it, They now both run at 30... Paste your sketch in a blank sketch, now running at 30 fps aswell...Close everything, reopen processing, paste your sketch...run at 60fps...Close Processing, reopen it and paste your code in a fresh windows, again 30 fps...

  • Hmm, thinking out loud, do you have a zombie P3 process running after the first run and shutdown? Task Manager should list it ...

  • Keyboard shortcut for Task Manager: CTRL+SHIFT+ESC.
    Also right-clicking at an empty spot on the taskbar and choose "Start Task Manager".

  • edited September 2016

    OK, I'm rather late, but I have a similar problem.
    I did many tests and here are my results(same program(which has a lot of 2D graphics), different renders)-
    JAVA2D (default as far as I know) - ~40fps (quality of graphics excellent)
    P2D (supposedly faster) - ~20fps (really poor quality)
    FX2D (supposedly fastest) - ~25fps (fair quality graphics, but still worse than J2D)
    And just for the sake of mentioning, P3D also runs at 20fps with graphics quality similar to FX2D. So why does this happen?
    PS - my laptop is not exactly good, just an AMD M320 2GB graphics card(IDK about the manufacturer).

Sign In or Register to comment.