v3ga

Bits and Blobs

The cube and the script

March 16th, 2007 · 2 Comments

Live scripting with Vision Factory

(Click to play the video)

I am in the process of integrating Javascript in Vision Factory through the use of Spidermonkey engine. The primary idea was to have an easy way to bind properties in an animation in order to avoid the fastidious (and often frantic) common recompilations every time one single parameter/formula had to be changed. It turned out that the integration went nice and smooth, so I decided to use scripting for the application set-up instead of dealing with configuration files. It actually makes things a lot clearer (I would dare to say ‘human-readable’), and most important easily maintainable.

Now, I am at a point where I am tempted to write a Javascript interface for every part of Vision Factory core engine. That is, not only scenes getters/setters would be accessible at runtime, but also basic services like sending/receiving network messages for example. Hmm, I have to think more about it as I want to keep things simple and flexible…

Anyway ! I just grabbed a little video showing how scripting integrates in the main application. The main component of Vision Factory is the layer manager, which allows to stack and blend scenes (with optional associated 2D filters) for rendering. Like every classes in the core engine, it exposes some properties that can be modified through user interface / network / scripting. I thought it would have been really cool to have a simple string property that would be interpreted as a script. Thus, it would be possible to inject javascript code in real-time into the application through network or UI. I sat down and started to wire the different parts together and … it worked !

The video shows a very basic rendering with two layers (a square and a rgb cube) whose parameters are live controlled by javascript. All is running on my local machine, with a processing server pumping up the script from hard-drive every second and sending it to the main application through network. Fun :-) With this configuration, one possible application would be a kind of collaborative live coding, each ‘participant’ having an assigned layer to change properties on.

I’ll try to design a better rendering example this week-end with easing, textures and stuff. Thanks for reading.

Tags: OpenGL · Vision Factory

2 responses so far ↓

  • 1 jesús gollonet // Mar 16, 2007 at 10:34 am

    wow, this is getting really exciting man. hope to put my hands on this soon.

    greetings from bcn.

  • 2 75 // Mar 21, 2007 at 11:28 pm

    j’aime beaucoup le “thanks for reading” :)

Leave a Comment