void setup(){
PImage flower = loadImage("bloom.jpg");
size(897, 565, P2D); //Line in Question
image(flower, 472+26,86, 189,189);
}
causes flickering but the second does not, however my main project uses createGraphics() which requires P2D or P3D
void setup(){
PImage flower = loadImage("bloom.jpg");
size(897, 565); //Fixed line version that doesnt work in main project I have
image(flower, 472+26,86, 189,189);
}
An even bigger problem is that if I add a draw loop to this the image just disappears
PImage flower;
void setup(){
flower = loadImage("bloom.jpg");
size(897, 565, P2D);
image(flower, 472+26,86, 189,189);
}
void draw(){
rect(10,10,10,10);
}
I don’t think it is recommended to do any drawing in setup(). It is meant to, you know set things up for action in draw() cycles. And size() function should be the very first thing in setup()
glv
May 15, 2022, 1:07am
3
Hello,
This works fine on Windows 10.
Try updatding to the latest version Processing 4.0 beta 8.
Try adding frameRate(30) to setup() .
Please report what happens after trying above.
Reference:
Hi all,
Wondering if anyone willing to share initial experiences with Processing on the new Mac hardware and “Big Sur” OS11 (OSX 11? OSXI?) … For context, we have a number of semi-permanent and permanent installations that use Mac minis and run Processing/Java full-out, thousands of threads, 24/7 type things, and sometimes require external hardware like sound cards etc. Wondering what kind of change we should be prepared for if we start using the new silicon and operating system. Catalin…
:)
Ok I updated to the latest macOS(affecting nothing)
The frameRate did nothing
and updating to the newest beta 8 didn’t fix the problem and in fact messed up the rest of the project
glv
May 26, 2022, 5:27pm
5
Hello @SomeOne ,
It does not matter where size() is in setup() as it is moved to settings() before running.
I always put it first for readable code. :)
Before:
void setup()
{
size(640, 360);
noLoop();
}
void draw()
{
background(0);
}
After < Click here for code
/* autogenerated by Processing revision 1283 on 2022-05-26 */
import processing.core.*;
import processing.data.*;
import processing.event.*;
import processing.opengl.*;
import java.util.HashMap;
import java.util.ArrayList;
import java.io.File;
import java.io.BufferedReader;
import java.io.PrintWriter;
import java.io.InputStream;
import java.io.OutputStream;
import java.io.IOException;
public class sketch_220526e extends PApplet {
public void setup()
{
/* size commented out by preprocessor */;
noLoop();
}
public void draw()
{
background(0);
}
public void settings() { size(640, 360); }
static public void main(String[] passedArgs) {
String[] appletArgs = new String[] { "sketch_220526e" };
if (passedArgs != null) {
PApplet.main(concat(appletArgs, passedArgs));
} else {
PApplet.main(appletArgs);
}
}
}
You can see these files in your %temp%
folder.
Reference:
Good code needs to meets two key requirements. First, it should be correct: when
executing, it should produce the result that is expected. Second, it should be
easy to read for other developers.
Coding is a social activity. Your code does not exist...
:)
1 Like