[fluxus] Stereo Fluxus

Dave Griffiths dave at pawfal.org
Wed May 16 02:20:13 PDT 2007


> Hi,
> I want to modify fluxus to allow for active stereo video [via crystal
> glasses], I've already done this for pd's GEM and it was quite easy,
> though they already had some other stereo modes.  Basically, I need to
> render the scene one time for each eye, selecting a different buffer to
> write to for each and offsetting the camera position slightly for each
> eye.  I intend to write it in such a way that one could select this
> functionality or not, so that it might actually be put into the main
> distro eventually as others might find it useful (once this stereo mode
> is in place it probably wouldn't be hard to implement other stereo modes).
>
> Anyways, if anyone could suggest where to implement this I'd appreciate
> it (i figure in the renderer, but where in the renderer :)

Do you want to do this inside the fluxus scratchpad (traditional style) or
with mred? It should be possible to do this with mred now, but I haven't
had a chance to figure out much of mred's gl canvas yet - but you should
be able to get it to change the draw buffer and rerender the scene.

To get it to work in the scratchpad, it'll take some C++ work - I think we
need a low level render command which sets the current buffer to draw to
from scheme (via glDrawBuffer) and enumerate all the options.

But however it's set, the place to make it work is from the frame
callback, which currently looks like this (and lives inside
scratchpad.ss):

(define (fluxus-frame-callback)
  (set-camera (get-camera-transform))
  (framedump-update)
  (begin-scene)
  (if (not (null? user-callback))
      (user-callback))
  (end-scene)
  (tick-physics)
  (update-audio))

We should be able to change it to something like:

(define (fluxus-frame-callback)

  ; draw the left buffer
  (draw-buffer 'back-left) ; or equivelent mred func call
  (set-camera (mmul (get-camera-transform)
     (mtranslate (vector -1 0 0)) ; move to the left
  (begin-scene)
  (if (not (null? user-callback))
      (user-callback))
  (end-scene)

  ; draw the right buffer
  (draw-buffer 'back-right) ; or equivelent mred func call
  (set-camera (mmul (get-camera-transform)
     (mtranslate (vector 1 0 0)) ; move to the right
  (begin-scene)
  (if (not (null? user-callback))
      (user-callback)) ; need to call the user callback twice, as immediate
                       ; mode objects will be lost the second time otherwise
  (end-scene)

  ; update everything that should only be updated once per frame
  (tick-physics)
  (update-audio))





More information about the Fluxus mailing list