We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpPrograms › start programming
Page Index Toggle Pages: 1
start programming (Read 834 times)
start programming
Sep 22nd, 2005, 10:08am
 
hi,

if've just startet reading about processing and i tried to make a test is wrote this code:

size (200,200);
background (255);
for (int i=0; i>=199; i=i+1)
{
 for (int e=0; e>=199; e=e+1)
 {
   point (i,e);
 }
}

but i only got a withe screen, why?

best
neugi
Re: start programming
Reply #1 - Sep 22nd, 2005, 10:56am
 
1 - The "for" loop is executed when the middle condition is true.
so you need to change >=  to <=

2 - If you write i = i+1 then you will draw a point on every single pixel of the drawing area so in the following example you will paint the whole area in black.


size (200,200);
background (255); //white background

for (int i=0; i<=199; i++) // a most common way of writing i = i+1 is i++
{
 for (int e=0; e<=199; e++)
 {
   point (i,e);
 }
}


You can then do things like this:

size (200,200);
background (255); //white background
stroke(255,0,0);  // draw the points in red

for (int i=0; i<=width; i+=2) // i+=2 will draw your points every 2 pixels.
{
 for (int e=0; e<=height; e+=2)
 {
   point (i,e);
 }
}

hope that helps.
Re: start programming
Reply #2 - Sep 22nd, 2005, 11:52am
 
thx helped a lot.

i've tried the i++ but it don't worked because of the <= />= mistake.

i'm currently reading the turorials but they are not completet now so is there any other source to lern processing?

thx
Re: start programming
Reply #3 - Sep 22nd, 2005, 12:58pm
 
The exhibition page with links to folks projects is a good place. Most people include their source code.

I mostly started playing with other peoples stuff (still do!). Ask questions when you get stuck. You'll normally get a fairly quick response.

the daniel shiffman stuff is also worth taking a look at. I think the link is on the site some where. Do a search for procedural painting

***update***

http://www.shiffman.net/teaching.html

try here!
Re: start programming
Reply #4 - Sep 22nd, 2005, 1:13pm
 
There is no unique way to learn a programming language or how to use processing really. Learning by example is quite effective to understand how things work and a good way to develop your own interest in a specific field too.

http://processing.org/faq/index.html#learn

The forum search and the processing example sketches are
good starts to find examples.

have fun!
Re: start programming
Reply #5 - Sep 22nd, 2005, 1:46pm
 
i currently only can php & mysql and the standart java for homepage Wink

so java (or wathever the language is like) is new to me. but i'll have a look at what you've posted

thx
Page Index Toggle Pages: 1