PGraphics and Android : very slow, even with simple sketch

edited December 2017 in Android Mode

Hi,

When I'm running this very simple sketch on a Samsung tab A (2016), frameRate is around 8fps, even with a very simple sketch as this one :

PGraphics pg; 
void setup() {
  size(displayWidth, displayHeight, P2D); 
  pg=createGraphics(width, height);
}

void draw() {
  println("fps : ", frameRate); 
  pg.beginDraw(); 
  pg.stroke(0); 
  pg.ellipse(width/2, height/2, 300, 300); 
  pg.endDraw(); 
  image(pg, 0, 0, width, height);
}

I tried different render (Default one, P2D, P3D, JAVA2D, OPENGL...), but still.

Do you have any idea where it come from (I have 2 times "OpenGL error 1280 at bot beginDraw(): invalid enum", aswell..) or how to manage things differently? I really need to draw on différent layer, because one has to be refhresh every frame and the other no...

Thanks for your help,

A.

Answers

  • It's definitly the beginDraw and endDraw which makes the sketch very slow, if you comment it and do something lile this, sketch is running at 60 fps...

    PGraphics pg; 
    void setup() {
      size(displayWidth, displayHeight, P2D); 
      pg=createGraphics(width, height);
      pg.beginDraw(); 
      pg.background(255); 
      pg.endDraw();
    }
    
    void draw() {
      println("fps : ", frameRate); 
      //pg.beginDraw(); 
      pg.stroke(0); 
      pg.ellipse(width/2, height/2, 300, 300); 
      //pg.endDraw(); 
      image(pg, 0, 0, width, height);
    }
    
  • By the way, I'm using processing 3.3.6 and Android mode 4.0.

Sign In or Register to comment.