iphone processing

mqwaq asked:


A port of Processing based on javascript, Processing.js and a custom built canvas-object running on the iPhone.

I was as impressed with the Processing.js implementation by John Resig as everyone else. And I naturally looked into the code to figure out how he had managed to do it. As he explains on his site, its all built around the browser canvas-object, and specifically the CanvasRenderingContext2D -object.

I had a look at the specification for the context object and the methods that Processing.js are using and realized that there were only about 8-10 methods needed.

So, I downloaded the JavaScript engine SpiderMonkey from Mozilla. With some inspiration from the Jiggy-project I configured and compiled it for the iphone. Then hooked it up with Processing.js, and wrote my own version of the context-object using OpenGL ES.

During this process I had to rewrite parts of Processing.js in ObjC for performance reasons.

Results? A hack of processing running on the iPhone with reasonable speed.

Examples shown in this video are StoringInput, BouncyBubbles (changed to use iphone accelerometer) and Substrate.

Share and Enjoy:
  • Digg
  • Facebook
  • MySpace
  • Live
  • Yahoo! Buzz
  • YahooMyWeb
  • del.icio.us
  • Mixx
  • Google
  • blogmarks
  • De.lirio.us
  • feedmelinks
  • Reddit
  • StumbleUpon
  • Technorati

21 Comments

  1. madcat1892 says:

    whats with the last one?

  2. jbe1996 says:

    Really cool!
    Lol, if i had an iPhone i could get hours doing that xD

  3. Emarvegt says:

    Great stuff! Is this available for download somewhere? Would be cool to run custom processing sketches on the iphone.

  4. SilverKey7 says:

    yeah me too.. what was the last one about ?

  5. cDima says:

    Meh, I implemented the “Substrate” in C# and it slows down after about 3 seconds to a hault. Will re-creating it in ObjC with a UIView be unreasonable because of speed?

    Great work. It inspired me to take on processing, and gave me enough enthusiasm to learn OpenGL ES to get enough speed for processing’s algorithm. Any tips?

  6. alguienyo says:

    22 year old female wanting to play with a bad? boy msn me or profile Z

  7. jonau65 says:

    good stuff, are you available for contract work?

  8. robot136230 says:

    idont get the last one …wat is it sapposesd to do or b

  9. takidiot says:

    do you have fun?

  10. trackrunner908 says:

    hey anyone, i want to make an iphone game so i need to buy books. what books would u say i need? also should it be on objective-c or opengl es book?
    Thanks!

  11. v8media says:

    Any chance of getting at your code? One specific thing I really want to try out is using something like those accelerometer bouncy balls as midi controls, like one mode of the Lemur.

  12. CatFiesta says:

    this is really awesome!

  13. vivified83 says:

    Will the code for this be released?

  14. vivified83 says:

    Any chance of this going open source?

  15. tarmato says:

    :-____________)

    That’s my jaw dropping to the floor. Now I’m out of excuses for not having an iPhone.

  16. EnDieG says:

    AMAZING but excuse me.. WTF are you doing there o.O

  17. multitouchy says:

    sick i hope this goes public i’m sure tons of ppl would love to use it

  18. mqwaq says:

    No, this is based purely on the SpiderMonkey engine with my own graphics-backend in OpenGL. To make it clear, I have only implemented the drawing functionality that Processing.js is using.

    I’m sure it would be possible to use the WebKit-code as well in some way. The big questions is if it would be fast enough.

  19. skierpage says:

    Most excellent! But I thought some of the Processing.js demos already work in Safari or latest WebKit. Surely you’re using some of Safari/WebKit to do this.

  20. stevecooley says:

    looks great! can’t wait till you can release the code. :)

  21. wheagy says:

    Excellent! Nice work.

Leave a Reply