processing sketches as interactive textures

i managed to get processing sketches working as textures in instant reality (x3d). now it is possible to simply write animated and interactive textures in processing and use them in 3d scenes. this is done by an applet wrapper that renders a processing sketch offline and copies its pixels[] array into an x3d SFImage().

processing_texture.jpg

update:
here is an example how to load a processing applet as texture in instant player..

ProcessingTexture.class is a wrapper class that loads a processing applet and puts its framebuffer into an SFImage. it also sends mouse events from instant player to the applet.

in order to load your processing applet you have to follow these steps:

  • download instant player and install it
  • download the zip with the wrapper class and the examples and extract it
  • write your processing sketch (size in power of two: 256×256, 512×512, 1024×512, ..), export it and copy the jar into the same folder as the example
  • open ProcessingTexture.x3d in a text editor
  • add your jar file to the “javaClassPath” in the ContextSetup node at the top of the file
  • change the value of the script node’s “name” field to the name of your applet (without .class or .pde)
  • open the x3d file in instant player. you should see your applet on a cube

download: instantprocessing.zip