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 › Transcripting from old Code...
Page Index Toggle Pages: 1
Transcripting from old Code... (Read 477 times)
Transcripting from old Code...
Mar 26th, 2007, 7:29pm
 
HI, I'm learning now, so perhaps this is a dull question. Anyway I was looking for some nice responsive creature done in processing and found this example in the ALPHA forum:

http://www.flight404.com/p5/tentacles_2/

I already transformed all the obvious syntax changes in order to run it in vers 0124 but there´s something I don´t get(This is just the first part of the transformed code - please check if needed the the complete one of the link):
import pitaru.sonia_v2_9.*;

// applet size variables
int xSize           = 600;
int ySize           = 350;
int xMid            = xSize/2;
int yMid            = ySize/2;

int frameRate = 30;

int counter = 0;

Camera camera;
Sound sound;
SpikeBall spikeBall;

boolean micInput = true;

void setup(){
 size(xSize, ySize, P3D);
 //lights();
 //smooth();
 frameRate(frameRate);
 ellipseMode(CENTER);
 colorMode(HSB,255);

 Sonia.start(this);

 // create camera (distance, lensAngle)
 camera = new Camera(37.0, 30.0);
 
 // create sound (sampleName, bands, history, speed, degrade)
 sound = new Sound("none", 512, 300, 10, 1.02);
 if (micInput){
   LiveInput.start(sound.bands);
   LiveInput.useEqualizer(true);
   LiveInput.useEnvelope(true,1.5);
 }
 
 // create spikeBall (numSpikes, spikeLength)
 spikeBall = new SpikeBall(64, 256);
 
for (int i=0; i<2; i++){
   g.lightKind[i] = SPECULAR;
 }
}

void draw(){
 background(175,100,35);
 doLights();
 sound.exist();
 camera.exist();
 spikeBall.exist();

 counter ++;

 delay(10);
}


void doLights(){
 lights();
 lightSpecular(204, 204, 204);
 for (int i=0; i<2; i++){
   g.lightX[i] = 0.5 * (i%2 - .5);
   g.lightY[i] = 0.25 * i;
   g.lightZ[i] = .5 + i;

   g.lightR[i] = 0.1;
   g.lightG[i] = i/3.0;
   g.lightB[i] = 0.0;
 }
}

What kind of class or function is that g? It doesn't appear in the code and is the only error I get...if I comment those lines, the program runs but off course there are no lights. In the FAQ and Reference section there's nothing about lights so...Help?
thx,


Page Index Toggle Pages: 1