
The above definition sends x and y coordinates to the processing sketch below using OSC. You can download the definition here: Rhino_to_Processing_OSC_1.zip.
import oscP5.*;
import netP5.*;
//intitialize x and y coordinate variables
float xpos = 0;
float ypos = 0;
OscP5 oscP5;
void setup() {
size(800, 800);
//start oscP5, listening for incoming messages at port 23000 */
oscP5 = new OscP5(this,23000);
}
void draw(){
background(0);
//draw ellipse at x and y coor
ellipse(xpos,ypos,100,100);
}
//incoming osc message are forwarded to the oscEvent method.
//this function i s only triggered when a message is recieved
void oscEvent(OscMessage theOscMessage) {
/* print the address pattern and the typetag of the received OscMessage */
print("### received an osc message.");
//messgae is sent as a string and needs to be conferted to a float
xpos = float(theOscMessage.get(0).stringValue());
ypos = float(theOscMessage.get(1).stringValue());
}