Page 1 of 1

Connecting Processing to MadMapper

Posted: Thu Oct 20, 2011 10:05 am
by NoobMapper
Hello all,

I've made an animation in processing. Basically quite simple, a user can type in his name and then change the colour of a cube. So for every new user a new name and a new cube is added.
I now want to map this on a real cube in my room.
So how can I connect Processing to MadMapper and is it possible at all to run them at the same time? Due to the mapped animation changes with every new user I don't have a "static" programm oder application or so.
Is there any tutorial to show how to get both programms connected?

Thanks for your help in advance!!!!!!

Re: Connecting Processing to MadMapper

Posted: Thu Oct 20, 2011 8:27 pm
by franz
to allow Processing to run Syphon, you need to build it from the CVS, so far.
Check you the Syphon forum for more help.
I "assume" Syphon will be officially supported in P5 in the future.

Re: Connecting Processing to MadMapper

Posted: Sat Nov 12, 2011 10:18 am
by The Midi Thief
Since you do something so simple you could maybe also consider recreating this project in Quartz Composer. You will probably having a much simpler time getting it working.

Just curious, are you adding cubes in your room for every user too?

Re: Connecting Processing to MadMapper

Posted: Sun Nov 13, 2011 10:12 pm
by NoobMapper
Hey,

I changed my setup of the installation, so maybe you have an idea how to do this (probably Quartz Composer is a possible solution):

I have a processing applet in which you can type in your name and choose a colour.
So you have things like "Susan" and green oder "John" and blue and so on.

Now I have a real cube in my room and I want to map colours on each part of the cube combined with the name of the person. So you have a green part with "Susan" on it and a blue part with "John" written on it and so on.
Is there any why to do this as a "live" update? So as soon as another person types in his name and chooses a colour the third part of the cube should be mapped with the colour + name.

I'm pleased for every information on doing this.
Probably Processing is not the right way to do this?

Thanks!!!!

Re: Connecting Processing to MadMapper

Posted: Sun Dec 04, 2011 7:40 pm
by Rich_G
Hello,

I've managed to plug Processing into MadMapper and other syphon enabled software quite easily using the JSyphon libs in both plain old java and in Processing. Just go to http://code.google.com/p/syphon-implementations/source/browse/#svn%2Ftrunk%2FSyphon%20Implementations%2FProcessing download the library and put it into Processing Library folder. It works like a treat for me, I've done a couple of small projects using it now, and am in the process of writing some simple apps like the Mad Labs ones but in Processing.

There is two methods of using it:
- either you can use the method shown in the examples
- or another method is to use the GLGraphics library to create an GLOffscreenBuffer, draw everything to the offscreen buffer then publish the offscreen buffer as a GLTexture to the Syphon server - Code example below.

Code: Select all

/*Processing to MadMapper, Modul8 and VDMX etc, using Syphon to output*/
import codeanticode.glgraphics.*;
import javax.media.opengl.*;
import processing.opengl.*;
import jsyphon.*;

JSyphonServer syphon;              // syphon
GLGraphicsOffScreen outputCanvas;  // offscreen buffer

GLTexture outTex;                  // output texture

int outW = 1024;                   // offscreen buffer width
int outH = 768;                    // offscreen buffer height

void setup() {
  size(1024, 768, GLConstants.GLGRAPHICS);
  background(0);
  smooth();
  frameRate(30);
  // setup the offscreen buffers
  outputCanvas = new GLGraphicsOffScreen(this, outW, outH, true, 4);
  // create the gl texture that will be sent to syphon
  outTex = new GLTexture(this);
  // init syphon
  initSyphon(outputCanvas.gl);
}

void draw() {
  // clear the background of the screen
  background(0, 0, 0);    
  // draw to the offscreen buffer   
  outputCanvas.beginDraw();
  // removed the clear for the desired drawing effect - should be included - acts like background(###);
  //canvas.clear(0, 0, 0, 0);
  outputCanvas.fill(0, 4);
  outputCanvas.noStroke();
  outputCanvas.rect(0, 0, width, height);
  if (frameCount%5==0) {
    outputCanvas.stroke(random(130, 170), random(220, 255), random(130));
    branch(outputCanvas, random(0, width), height, height-(random(120, height-50)), radians(270));
  }
  outputCanvas.endDraw();
  // retrieve the offscreen buffer
  outTex = outputCanvas.getTexture();
  // display offscreen buffer to the screen
  image(outTex, 0, 0);
  // publish the offscreen buffer to syphon
  syphon.publishFrameTexture(outTex.getTextureID(), outTex.getTextureTarget(), 0, 0, outTex.width, outTex.height, outTex.width, outTex.height, true);
}

// draw a recursive tree routine
void branch(GLGraphicsOffScreen c, float x, float y, float s, float a) {
  c.strokeWeight(s*0.04);
  a+=radians(random(-7, 7));
  float newx = x+cos(a)*s;
  float newy = y+sin(a)*s;
  c.line(x, y, newx, newy);
  if (s>3) {
    branch(c, newx, newy, s*(random(0.55, 0.70)), a-radians(random(17, 12)));
    branch(c, newx, newy, s*(random(0.55, 0.70)), a+radians(random(17, 12)));
  }
}

// init syphon
void initSyphon(GL gl) {
  if (syphon != null) {
    syphon.stop();
  }
  syphon = new JSyphonServer();
  //syphon.test();
  syphon.initWithName("Processing_OffscreenTest");
}


Hope this helps

Re: Connecting Processing to MadMapper

Posted: Tue Jun 25, 2013 1:43 pm
by baklazanek
Rich_G wrote:Hello,

I've managed to plug Processing into MadMapper and other syphon enabled software quite easily using the JSyphon libs in both plain old java and in Processing. Just go to http://code.google.com/p/syphon-implementations/source/browse/#svn%2Ftrunk%2FSyphon%20Implementations%2FProcessing download the library and put it into Processing Library folder. It works like a treat for me, I've done a couple of small projects using it now, and am in the process of writing some simple apps like the Mad Labs ones but in Processing.

There is two methods of using it:
- either you can use the method shown in the examples
- or another method is to use the GLGraphics library to create an GLOffscreenBuffer, draw everything to the offscreen buffer then publish the offscreen buffer as a GLTexture to the Syphon server - Code example below.

Code: Select all

/*Processing to MadMapper, Modul8 and VDMX etc, using Syphon to output*/
import codeanticode.glgraphics.*;
import javax.media.opengl.*;
import processing.opengl.*;
import jsyphon.*;

JSyphonServer syphon;              // syphon
GLGraphicsOffScreen outputCanvas;  // offscreen buffer

GLTexture outTex;                  // output texture

int outW = 1024;                   // offscreen buffer width
int outH = 768;                    // offscreen buffer height

void setup() {
  size(1024, 768, GLConstants.GLGRAPHICS);
  background(0);
  smooth();
  frameRate(30);
  // setup the offscreen buffers
  outputCanvas = new GLGraphicsOffScreen(this, outW, outH, true, 4);
  // create the gl texture that will be sent to syphon
  outTex = new GLTexture(this);
  // init syphon
  initSyphon(outputCanvas.gl);
}

void draw() {
  // clear the background of the screen
  background(0, 0, 0);    
  // draw to the offscreen buffer   
  outputCanvas.beginDraw();
  // removed the clear for the desired drawing effect - should be included - acts like background(###);
  //canvas.clear(0, 0, 0, 0);
  outputCanvas.fill(0, 4);
  outputCanvas.noStroke();
  outputCanvas.rect(0, 0, width, height);
  if (frameCount%5==0) {
    outputCanvas.stroke(random(130, 170), random(220, 255), random(130));
    branch(outputCanvas, random(0, width), height, height-(random(120, height-50)), radians(270));
  }
  outputCanvas.endDraw();
  // retrieve the offscreen buffer
  outTex = outputCanvas.getTexture();
  // display offscreen buffer to the screen
  image(outTex, 0, 0);
  // publish the offscreen buffer to syphon
  syphon.publishFrameTexture(outTex.getTextureID(), outTex.getTextureTarget(), 0, 0, outTex.width, outTex.height, outTex.width, outTex.height, true);
}

// draw a recursive tree routine
void branch(GLGraphicsOffScreen c, float x, float y, float s, float a) {
  c.strokeWeight(s*0.04);
  a+=radians(random(-7, 7));
  float newx = x+cos(a)*s;
  float newy = y+sin(a)*s;
  c.line(x, y, newx, newy);
  if (s>3) {
    branch(c, newx, newy, s*(random(0.55, 0.70)), a-radians(random(17, 12)));
    branch(c, newx, newy, s*(random(0.55, 0.70)), a+radians(random(17, 12)));
  }
}

// init syphon
void initSyphon(GL gl) {
  if (syphon != null) {
    syphon.stop();
  }
  syphon = new JSyphonServer();
  //syphon.test();
  syphon.initWithName("Processing_OffscreenTest");
}


Hope this helps


You just saved my life! :wink: