I’m not sure if I’m just overestimating the abilities of the Pi, but I’m trying to run a simple program to draw an artificial horizon, and while it runs buttery smooth on my desktop (normal windows 10 computer) as soon as I try to run it on the pi, the performance CRAWLS. Just over drawing a simple image…
I must be doing something wrong here? Why is it so slow? I’ve tried changing the render mode to fullscreen, which helped… but how is it that this thing can play minecraft at a smooth framerate and yet struggles to break 10fps drawing a single image over and over?
EDIT: I just realized I never attached the image. Use this one: https://imgur.com/a/QBVnmXG
Here is my code:
//mfd test for aircraft
PGraphics ghorizon;
float horizH = 250;
float horizR;
PImage img;
float testx;
float testy;
void setup() {
fullScreen();
img = loadImage("artificial horizon 2.png");
ghorizon = createGraphics(550, 500);
drawbg();
}
void draw() {
// drawhorizon();
drawhorizon2(200,60);
testx = sin(float(frameCount)/100)*100;
testy = sin(float(frameCount)/150)*100;
}
void drawbg() {
background(0);
}
void drawhorizon2(int x,int y) {
ghorizon.beginDraw();
// ghorizon.background(0);
ghorizon.translate(275,250);
ghorizon.rotate(radians((testx))/4);
ghorizon.translate(0,testy);
ghorizon.image(img,-500,-1250);
ghorizon.endDraw();
image(ghorizon,x,y);
stroke(0);
noFill();
strokeWeight(20);
rect(x-10,y-10,570,520,40);
stroke(255);
strokeWeight(12);
line(x+150,y+250,x+220,y+250);
line(x+220,y+250,x+220,y+270);
line(x+330,y+250,x+400,y+250);
line(x+330,y+250,x+330,y+270);
stroke(0);
strokeWeight(8);
line(x+150,y+250,x+220,y+250);
line(x+220,y+250,x+220,y+270);
line(x+330,y+250,x+400,y+250);
line(x+330,y+250,x+330,y+270);
strokeWeight(3);
stroke(255,0,255);
line(x+275,y+175,x+275,y+325);
line(x+200,y+250,x+350,y+250);
}