Problems with canvas size


#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


#2

Hey mojo,

Could you post your code so we can see what is happening?


#3

Did you specify the sketches size in void setup() {} with size(width,height);?


#4

Hi Scott,

This is the code:

ellipse(200, 250, 200, 200) ;

Cheers Joe!


#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


#6

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)?


#7

I also suggest you check out https://processing.org/tutorials/ for more basic information on Processing.


#8

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


#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


#10

When I go to the Shapes section and click “Skip to Exercise” I see this:

48%20AM

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?


#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