Processing to Modul8 and Madmapper Via Shypon

Gracias a Miguel por hacer este tutorial para conectar Processing con Modul8 y MadMapper. Enlace al artículo original.

A continuación todo explicado paso a  paso.

The first stop you need to do is to allow Modul8 to run a Quartz Composer Syphon Client. The last version of Modul8 (2.6.4 supports native syphon server but not clients). In other words, you can send frames to another applications like Mad Mapper, but you cannot receive frames from Max, OF or Processing.

The unofficial way of getting Syphon Clients into Modul8 is explained in the next video. You can skip the video and follow the steps below.

The first stop you need to do is to allow Modul8 to run a Quartz Composer Syphon Client. The last version of Modul8 (2.6.4 supports native syphon server but not clients). In other words, you can send frames to another applications like Mad Mapper, but you cannot receive frames from Max, OF or Processing.

The unofficial way of getting Syphon Clients into Modul8 is explained in the next video. You can skip the video and follow the steps below.

First, you need to install:

(1) QCRehab.plugin in /Library/Graphics/Quartz Composer Patches/

I got it from here: http://kineme.net/release/OfficialAPISubpatchSupport/03

I have put it here:

(2) You have to install the Syphon.plugin in /Library/Graphics/Quartz Composer Plug-Ins

I have downloaded this version: “Syphon For Quartz Composer Public Beta 2.dmg, from here:
http://code.google.com/p/syphon-implementations/downloads/list

and installed it here:

(3) Finally you start Modul8 and put the “Syphon Client QC.qtz in your Media set. You find the Syphon Client in the examples folder in the Syphon For Quartz Composer.dmg. Then you just run it on a layer.

To test if everything went fine, you can run the quartz composer server Syphon Server QC.qtz that you just have downloaded together with the client.

I’ve got this running like this image:


When this is done you can close Quartz Composer Syphon Server and go to the Processing part.

I’m using version Processing 1.5.1. Things will change for Processing 2.x because of the integration with OPENGL2, but so far this is working for me.

I’ve got all the information from this post: http://forum.processing.org/topic/syphon-integration-with-processing#25080000000858073

First, you have to install the Syphon library in your Processing Libraries folder. I’ve got it from here:
http://interfaze.info/files/syphon/Syphon-0.0.1.zip

To install the library in Processing you  Ctrl-Click on the application icon and then navigate to the library folder, and copy all the zip content.


Then you start Processing and create a new sketch. I’ve done a simple code that you can just copy and paste in your file:

import javax.media.opengl.*;
import processing.opengl.*;
import jsyphon.*; // Syphon

JSyphonServer mySyphon;
PGraphicsOpenGL pgl;
GL gl;
int[] texID;

void setup() {
  size(640, 480, OPENGL);
  pgl = (PGraphicsOpenGL) g;
  gl = pgl.gl;
  initSyphon(gl,"processing");

  strokeWeight(0.5);
  stroke(255, 50);
  background(0);

}

void draw() {
  line(width/2, height/2, random(0, width), random(0, height));
  renderTexture(pgl.gl);
}

void initSyphon(GL gl, String theName) {
    if(mySyphon!=null) {
      mySyphon.stop();
    }
    mySyphon = new JSyphonServer();
    mySyphon.test();
    mySyphon.initWithName(theName);

    // copy to texture, to send to Syphon.
    texID = new int[1];
    gl.glGenTextures(1, texID, 0);
    gl.glBindTexture(gl.GL_TEXTURE_RECTANGLE_EXT, texID[0]);
    gl.glTexImage2D(gl.GL_TEXTURE_RECTANGLE_EXT, 0, gl.GL_RGBA8, width, height, 0, gl.GL_RGBA, gl.GL_UNSIGNED_BYTE, null);
} 

void renderTexture(GL gl) {
  gl.glBindTexture(gl.GL_TEXTURE_RECTANGLE_EXT, texID[0]);
  gl.glCopyTexSubImage2D(gl.GL_TEXTURE_RECTANGLE_EXT, 0, 0, 0, 0, 0, width, height);
  mySyphon.publishFrameTexture(texID[0], gl.GL_TEXTURE_RECTANGLE_EXT, 0, 0, width, height, width, height, false);
}

public void stop() {
  dispose();
}

void dispose() {
  println("\n\nabout to stop sketch ...");
  println("deleting textures");
  gl.glDeleteTextures(1, texID, 0);
  if(mySyphon!=null) {
    println("stopping the syphon server");
    mySyphon.stop();
  }
  println("sketch stopped, done.");
}

Now, if you run the application together with Modul8 you should get something like that:

Of course you can skip the Modul8 part and use Processing directly with MadMapper, like this example in which I used a slightly more complex particle system than the previous example.

For the example I’ve use controlP5 library to control some variables of the system. The library is available here: http://www.sojamo.de/libraries/controlP5/

Here’s the integration with the MSAFluid library from Memo.tv. You can download the code (which is basically merging the example with the syphon template). Thanks Memo for the library! Download the file here: MSAFluid to Syphon (872)

And here, you see it working:

Miguel V Espada es Doctor en Lógica por el CWI de Amsterdam. Licenciado por la Universidad de Zaragoza. Profesor de la Universidad Complutense de Madrid desde el 2005. A su vez, realiza estudios de filosofí­a por la universidad a distancia y en 2008 obtiene el diploma de estudios avanzados en la facultad de Bellas Artes de la UCM, con el tí­tulo: De la lógica analógica a la lógica digital. Lo Sublime 2.0: el retorno de lo sublime en las artes visuales contemporáneas, donde establece las bases sobre una estética del arte digital. Es co-fundador del estudio espada y santacruz, espacio dedicado a la creación, producción e investigación en las artes visuales. Sus trabajos se centran en la reflexión creativa acerca de los temas clásicos del arte bajo el prisma de los nuevos medios de expresión artí­stica. Sus trabajos abarcan desde la fotografí­a, videoarte hasta las artes escénicas y las instalaciones interactivas.