Next: , Previous: Making Movies, Up: Top



11 Fluxus scratchpad and modules

Fluxus consists of two parts. One part is the window containing a script editor rendered on top of the scene display render. This is called the fluxus scratchpad, and it's the way to use fluxus for livecoding and general playing. The functions which you call are part of the fluxus modules which can either be loaded into the fluxus scratchpad, or the drscheme IDE.

11.1 Fluxus modules

Fluxus's functionality is split between different Scheme modules. You don't need to know any of this to simply use fluxus as is, as they are all loaded and setup for you.

11.1.1 fluxus-engine

This contains the core rendering functions, and the majority of the commands.

11.1.2 fluxus-audio

The jack client and fft processor commands.

11.1.3 fluxus-osc

The osc server and client, and message commands.

11.1.4 scratchpad scratchpad-camera scratchpad-input

These scheme modules inteface the scratchpad with fluxus-engine.

11.2 Using fluxus in DrScheme

You can load the fluxus modules into the DrScheme interpreter, and use it as a better IDE for writing fluxus Scheme scripts. This is possible using PLT's interface toolkit MrEd, which allows us to call fluxus commands in an OpenGL context. This is much lower level than using the fluxus scratchpad interpreter at present, although it should be possible to do everything in DrScheme with a little work.

     (require
      (lib "gl.ss" "sgl") ; load PLT's opengl modules
      (prefix gl- (lib "sgl.ss" "sgl")))
     
     ; load the fluxus-engine binary extension
     (load-extension "/usr/local/lib/plt/collects/fluxus-0.12/compiled/native/i386-linux/fluxus-engine.so")
     (require fluxus-engine)
     (clear-engine)
     
     (define fluxus-canvas%
       (class* canvas% ()
         (inherit with-gl-context swap-gl-buffers)
     
         (define/override (on-paint)
           (with-gl-context
            (lambda ()
              (glClearColor 0.0 0.0 0.0 0.0)
              (gl-clear 'color-buffer-bit 'depth-buffer-bit)
     
     		 ; we can now call fluxus commands
              (begin-scene) ; low level fluxus command to begin rendering
              (draw-cube) ; do something exciting
              (end-scene) ; low level fluxus command to end rendering
     
              (swap-gl-buffers)
              (super on-paint))))
     
         (define/override (on-size width height)
           (with-gl-context
            (lambda () 0)))
     
         (super-instantiate () (style '(gl)))))
     
     (define frame (instantiate frame% ("fluxus in mred")))
     (define fluxus-canvas (instantiate fluxus-canvas% (frame) (min-width 640) (min-height 400)))
     (send frame show #t)