PShape performance
in
Android Processing
•
24 days ago
Hi
In Java Mode, the following code (based on Dan Shiffman's PShape tutorial) runs at about 50-54fps on my PC, but on an Android tablet (a good one), only at 7fps. I have tried a few display modes and the best seems to be P2D. Any help/thoughts as to why there is this huge performance difference?
Many thanks
Mark
- int number=500;
- Polygon[] polygons = new Polygon[number];
- PShape rectangle;
- void setup() {
- size(640, 360, P2D); // 6 to 7 fps
- // size(640, 360, OPENGL); //2 to 3 fps and it looks wierd
- // size(640, 360); // PShape doesn't work
- rectangle = createShape(RECT, 10, 10, 60, 40);
- //create array of rectangles
- for (int i = 0; i < number; i++) {
- polygons[i] = new Polygon(rectangle, random(0, width), random(10, height));
- }
- }
- void draw() {
- background(51);
- for (int i = 0; i < number; i++) {
- polygons[i].display();
- }
- text(frameRate, 10, 10);
- }
- class Polygon {
- PShape s;
- float x, y;
- Polygon(PShape s_, float _x, float _y) {
- s = s_;
- x=_x;
- y=_y;
- }
- void display() {
- shape(s, x, y);
- }
- }
1