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 & HelpOther Libraries › Draw with processing
Page Index Toggle Pages: 1
Draw with processing (Read 551 times)
Draw with processing
Jul 1st, 2008, 6:34pm
 
Hi!

I'm a new user of Processing and (after 1 second), i've got a problem!

I want to draw a circle using the ir spots of the Led Bar. I've taken this code using the osc p5 with a sketch found in this forum.

This is my code:

import processing.opengl.*;
import javax.media.opengl.*;
import javax.media.opengl.glu.*;


WiiController wiiController;


static final int MAX_SIZE = 15;

GL gl;
PGraphicsOpenGL pgl;
Point currPoint;

float w = 400;
float h = 400;
float wn = 400;
float hn = 400;
float newH = 100;
float newW = 100;
float newHn = 100;
float newWn = 100;


int ledCnt = 0;
 
void setup() {
 size(1280,1280,OPENGL);
 pgl = (PGraphicsOpenGL)g;
 gl = pgl.gl;
 frameRate(25);
 noStroke();

 wiiController = new WiiController();
 rectMode(CENTER);
}

void mousePressed() {

 wiiController.requestBatterylevel();

 
}

void irEvent(float x1, float y1, float s1, float x2, float y2, float s2, float x3, float y3, float s3, float x4, float y4, float s4) {

if ((s1 > MAX_SIZE) || (s2 > MAX_SIZE)) {

// IR point is not available
return;
}
}

void keyPressed() {

 ledCnt++;
 ledCnt %=4;
 int[] t = new int[] {
   0,0,0,0  };
   t[ledCnt] = 1;    
   wiiController.led(t);

}
void draw() {
   fill(0,10);
 rectMode(CORNER);
 rect(0,0,width,height);

 stroke(266); {
    fill(200, 800, 0, 70);
   ellipse (currPoint.x, currPoint.y, 100, 100);
 }
}


but this part became yellow :
  ellipse (currPoint.x, currPoint.y, 100, 100);

and then i've this error message: NullPointerException.


Can you help me????

Bye!

Gio

PS:
This is the link of the original code:
http://code.google.com/p/darwiinosc/downloads/list
Re: Draw with processing
Reply #1 - Jul 1st, 2008, 7:59pm
 
I can't see any point in your code where you actually create a Point object to assign currPoint to, or ever set the values of currPoint...
Page Index Toggle Pages: 1