Show image in setup


#1

Dear all,
I wrote a processing sketch that has a very long setup function. During setup I have to read many files and I have to initialize a large number of varabiles.
Unfortunately during setup the screen is complitely black and it is not so good.
Can I display an image in the setup function ?

Thank you very much for your help and cooperation
regards


#2

Unfortunately, the screen only started rendering after void draw starts.

Luckily, you can easily put your setup code in a function, and run it during the start of draw. Eg.

String scene = "setup";

void setup() {
  size(...);
}

void draw() {
  switch(scene) {
  case "setup":
    ...Display stuff here...
    setupSketch();
    scene = "loaded";
    break;
  case "loaded":
    ...Your code here...
    break;
  }
}

void setupSketch() {
  ...Your setup code here...
}

#3

Processing.org/reference/requestImage_.html


#4

Thank you! :star_struck:
regards.