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 › MultiTouchPad in MacOSX/Processing
Page Index Toggle Pages: 1
MultiTouchPad in MacOSX/Processing (Read 583 times)
MultiTouchPad in MacOSX/Processing
Nov 8th, 2009, 5:02pm
 
Hi,
I found a little software that allows use MultiTouchPad in MacOSX...
tongsengmod [http://github.com/fajran/tongseng]

Originally, i found this using with supercollider - with Batuhan Bozkurt's Object MultiTouchPad [http://www.batuhanbozkurt.com/] -
but i tested with Processing Cheesy

Install in MacOSX:
* Extract the source archive (for example, to the desktop).
* From terminal:
     $ cd ~/Desktop
     $ cd <extracted folder name>
     $ make
     $ sudo make install


before run Processing sketch:
*in terminal:
       $ tongsengmod -v 127.0.0.1 3333
       ( -v is optional, see tongsengmod -h for help);

and run a sketch with TUIO lib Smiley

// we need to import the TUIO library
// and declare a TuioProcessing client variable
import TUIO.*;
TuioProcessing tuioClient;

// these are some helper variables which are used
// to create scalable graphical feedback
float cursor_size = 15;
float object_size = 60;
float table_size = 760;
float scale_factor = 0.7;
void setup()
{
 //size(screen.width,screen.height);
 size(640,480);
 noStroke();
 fill(0);
 
 loop();
 frameRate(30);
 //noLoop();
 
 // we create an instance of the TuioProcessing client
 // since we add "this" class as an argument the TuioProcessing class expects
 // an implementation of the TUIO callback methods (see below)
 tuioClient  = new TuioProcessing(this);
}

// within the draw method we retrieve a Vector (List) of TuioObject and TuioCursor (polling)
// from the TuioProcessing client and then loop over both lists to draw the graphical feedback.
void draw()
{
 background(255);
 float obj_size = object_size*scale_factor;
 
 Vector tuioObjectList = tuioClient.getTuioObjects();
 for (int i=0;i<tuioObjectList.size();i++) {
    TuioObject tobj = (TuioObject)tuioObjectList.elementAt(i);
    stroke(0);
    fill(0);
    pushMatrix();
    translate(tobj.getScreenX(width),tobj.getScreenY(height));
    ellipse(-obj_size/2, -obj_size/2, obj_size, obj_size);
    //rect(-obj_size/2,-obj_size/2,obj_size,obj_size);
    popMatrix();
    fill(255);
  }
}

// these callback methods are called whenever a TUIO event occurs

// called when an object is added to the scene
void addTuioObject(TuioObject tobj) {
 println("add object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle());
}

// called when an object is removed from the scene
void removeTuioObject(TuioObject tobj) {
 println("remove object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+")");
}

// called when an object is moved
void updateTuioObject (TuioObject tobj) {
 println("update object "+tobj.getSymbolID()+" ("+tobj.getSessionID()+") "+tobj.getX()+" "+tobj.getY()+" "+tobj.getAngle()
         +" "+tobj.getMotionSpeed()+" "+tobj.getRotationSpeed()+" "+tobj.getMotionAccel()+" "+tobj.getRotationAccel());
}

// called after each message bundle
// representing the end of an image frame
void refresh(TuioTime bundleTime) {
 redraw();
}


I wanted to make this without a lot of code...
it's possible send Unix commands in processing? Shocked
Page Index Toggle Pages: 1