Image loading slowing down program
in
Programming Questions
•
8 months ago
I was messing around with background images, and for some reason if i don't load the image immediately before i want to use it, a null pointer comes up.
right now this is what i have, and it seems to be resource heavy due to constant image loading
- PImage BACK;
- public void setup()
- {
- size(600,600,P2D);
- }
- public void draw()
- {
- background((loadImage("microbial.jpg").get(mouseX,mouseY,600,600)));
- }
I would expect this to work and it doesn't
- PImage img;
- img = loadImage("microbial.jpg");
- public void setup()
- {
- size(600,600,P2D);
- }
- public void draw()
- {
- background((img.get(mouseX,mouseY,600,600)));
- }
1