Giova
YaBB Newbies
Offline
Posts: 9
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