FAQ
Cover
This is the archive Discourse for the Processing (ALPHA) software.
Please visit the new Processing forum for current information.

   Processing 1.0 _ALPHA_
   Programming Questions & Help
   Syntax
(Moderators: fry, REAS)
   newbye with simple problem :)
« Previous topic | Next topic »

Pages: 1 
   Author  Topic: newbye with simple problem :)  (Read 1440 times)
marquete

Email
newbye with simple problem :)
« on: Apr 10th, 2005, 11:44pm »

Hi!
 
I started playing with processing yesterday and tried to plot some 3d according to Sonia, but the script keeps drawing the new frame over the others and I wanted it just to refresh the polygon. Can someone help? This is the script...
 
void setup()
{
framerate(15);
lights();
size(500, 500);
background(255);
Sonia.start(this);
LiveInput.start(16);
}
 
void loop()
{
plot();
}
 
void plot(){
LiveInput.getSpectrum();
// letra p
beginShape(TRIANGLE_STRIP);
fill(204, 102, 0);
noStroke();
/*1*/vertex(80,280,LiveInput.spectrum[1]/10);
/*2*/vertex(40,240,LiveInput.spectrum[2]/10);
/*3*/vertex(80,200,LiveInput.spectrum[3]/10);
/*4*/vertex(40,160,LiveInput.spectrum[4]/10);
/*5*/vertex(80,120,LiveInput.spectrum[5]/10);
/*6*/vertex(40,80,LiveInput.spectrum[6]/10);
/*7*/vertex(80,40,LiveInput.spectrum[7]/10);
/*8*/vertex(120,80,LiveInput.spectrum[8]/10);
/*9*/vertex(160,40,LiveInput.spectrum[9]/10);
/*10*/vertex(200,80,LiveInput.spectrum[10]/10);
/*11*/vertex(160,120,LiveInput.spectrum[11]/10);
/*12*/vertex(200,160,LiveInput.spectrum[12]/10);
/*13*/vertex(160,200,LiveInput.spectrum[13]/10);
/*14*/vertex(120,160,LiveInput.spectrum[14]/10);
/*15*/vertex(80,200,LiveInput.spectrum[15]/10);
/*15*/vertex(80,200,-40);
/*14*/vertex(120,160,-40);
/*13*/vertex(160,200,-40);
/*12*/vertex(200,160,-40);
/*11*/vertex(160,120,-40);
/*10*/vertex(200,80,-40);
/*9*/vertex(160,40,-40);
/*8*/vertex(120,80,-40);
/*7*/vertex(80,40,-40);
/*6*/vertex(40,80,-40);
/*5*/vertex(80,120,-40);
/*4*/vertex(40,160,-40);
/*3*/vertex(80,200,-40);
/*2*/vertex(40,240,-40);
/*1*/vertex(80,280,-40);
endShape();
}
 
public void stop(){
Sonia.stop();
super.stop();
}
 
 
I tried to find the bug but found nothing.
Thanx
 
arielm

WWW
Re: newbye with simple problem :)
« Reply #1 on: Apr 11th, 2005, 8:01am »

you are the one in charge for clearing the screen between each frame, e.g.
 
Code:
background(0)

at the beginning of loop()
 

Ariel Malka | www.chronotext.org
marquete

Email
Re: newbye with simple problem :)
« Reply #2 on: Apr 11th, 2005, 8:03pm »

Thanks! Works fine!
I'll take a closer look to this kind of things as I only took a glance to the syntax (voids, ifs, elses, fors..).
 
Pages: 1 

« Previous topic | Next topic »