mojo
October 1, 2018, 9:08pm
1
Hi there,
I am happy to have started to learn Processing however I seem to have fallen at the first hurdle.
When I am completing the beginner tutorial video, and code I type in just results in what I would guess to be a 25x25 pixel grey canvas.
I sometimes catch a glimpse of the shape if I make it big enough.
Thank you for any help given!
Cheers Joe
Hey mojo,
Could you post your code so we can see what is happening?
Sarah
October 2, 2018, 1:23am
3
Did you specify the sketches size in void setup() {}
with size(width,height);
?
mojo
October 2, 2018, 7:07am
4
Hi Scott,
This is the code:
ellipse(200, 250, 200, 200) ;
Cheers Joe!
mojo
October 2, 2018, 7:08am
5
I didn’t! In the video Dan Shiffman doesn’t specify to do so!
Is this something you always need to do or perhaps a change in the update?
Many thanks, Joe
Usually you need a call to size()
to specify how big the sketch window should be.
Try this:
size(600,400);
ellipse(200, 250, 200, 200);
You might also consider using setup()
and draw()
, like so:
void setup(){
size(600,400);
}
void draw(){
background(0);
ellipse(200, 250, 200, 200);
}
This is about as basic as a decent sketch gets. next, try adding color (stroke()
or fill()
), or maybe move the ellipse (try drawing it at (mouseX
, mouseY
) instead)?
3 Likes
Sarah
October 2, 2018, 8:03am
7
I also suggest you check out https://processing.org/tutorials/ for more basic information on Processing.
1 Like
In general:
If you do not define a sketch size, a sketch defaults to 100x100 pixels.
For this reason, almost every example sketch (see the examples in your PDE Examples folder) defines a size()
in setup()
.
https://processing.org/reference/size_.html
1 Like
mojo
October 3, 2018, 7:22pm
9
Amazing, thank you everyone for your help. My processing journey shall continue.
http://hello.processing.org/editor/
That is the video I was following, the problem is in the shapes section.
Cheers Joe
When I go to the Shapes section and click “Skip to Exercise” I see this:
What is the problem you are having with it? Was your browser window too narrow to see the full output area?
Or is the issue that you wanted to do the exercise in the desktop PDE, and that the example didn’t have a size directive when you cut-pasted it?
mojo
October 6, 2018, 11:28am
11
Hi Jeremy,
It was that it didn’t have a size directive in the code when I copied and pasted it, but he doesn’t make it clear to do so.
Many thanks, Joe
random
April 21, 2022, 2:35pm
12
I have a similar problem. I define size canvas on processing 3 but it shows a huge canvas
size() definition must be in setup() otherwise it’s ignored.