GMU:(In)Visible Networks/Esra Demirel: Difference between revisions

From Medien Wiki
No edit summary
Line 31: Line 31:
import oscP5.*;
import oscP5.*;
import netP5.*;
import netP5.*;
OscP5 oscP5;
OscP5 oscP5;
NetAddress myRemoteLocation; // IP of Computer running captury, Port configured in software
NetAddress myRemoteLocation; // IP of Computer running captury, Port configured in software
long lastMillis=0; // used to periodically send subscribe messages
long lastMillis=0; // used to periodically send subscribe messages
ArrayList <PVector> joints=new ArrayList <PVector>(); // used to buffer joint positions between oscEvent callbacks and "draw" calls
ArrayList <PVector> joints=new ArrayList <PVector>(); // used to buffer joint positions between oscEvent callbacks and "draw" calls
void setup() {
void setup() {
   fullScreen();
   fullScreen();
Line 44: Line 40:
   oscP5 = new OscP5(this, 1065);
   oscP5 = new OscP5(this, 1065);
   myRemoteLocation = new NetAddress("141.54.159.160", 1065); // our computer...
   myRemoteLocation = new NetAddress("141.54.159.160", 1065); // our computer...
}
}void draw() {
void draw() {
   // periodically ask the captury server to send us data.
   // periodically ask the captury server to send us data.


Line 53: Line 48:
     //most of the placeholders can be replaced by a "*" for "everything"
     //most of the placeholders can be replaced by a "*" for "everything"
     // unfortunately, if you subscribe to too many things, a bug in the captury will lead to malformed OSC-bundles that in turn crash OSCP5
     // unfortunately, if you subscribe to too many things, a bug in the captury will lead to malformed OSC-bundles that in turn crash OSCP5
 
OscMessage myMessage = new OscMessage("/subscribe/*/blender/Head/vector"); // get positions ("vector") of all joints of actor "felix_braun_rot" in mm
    OscMessage myMessage = new OscMessage("/subscribe/*/blender/Head/vector"); // get positions ("vector") of all joints of actor "felix_braun_rot" in mm
oscP5.send(myMessage, myRemoteLocation);}
    oscP5.send(myMessage, myRemoteLocation);
strokeWeight(4);   
  }
 
  strokeWeight(4);   
   // go through list of joints and draw them all
   // go through list of joints and draw them all
   frameRate(5);
   frameRate(5);
Line 73: Line 65:


/* incoming osc message are forwarded to the oscEvent method. */
/* incoming osc message are forwarded to the oscEvent method. */
void oscEvent(OscMessage theOscMessage) {
void oscEvent(OscMessage theOscMessage) {
   println(theOscMessage); // debug out
   println(theOscMessage); // debug out
Line 80: Line 73:
     println( theOscMessage.get(0).floatValue());
     println( theOscMessage.get(0).floatValue());
     println( theOscMessage.get(1).floatValue());
     println( theOscMessage.get(1).floatValue());
     println( theOscMessage.get(2).floatValue());
     println( theOscMessage.get(2).floatValue());}}
  }
}




This Processing Sketch show how OSC protocol is used and how our draw function is inserted inside that protocol.
This Processing Sketch show how OSC protocol is used and how our draw function is inserted inside that protocol.
First of all oscP5 and netP5 libraries are imported inside the sketch.In order to use OSC protocol we have to import those library. There are 3 messages received from Captury, they are x,y,z coordinates of the tracked person locations.
First of all oscP5 and netP5 libraries are imported inside the sketch.In order to use OSC protocol we have to import those library. There are 3 messages received from Captury, they are x,y,z coordinates of the tracked person locations.