[Fluxus] HelloWorld
Dave Griffiths
dave at pawfal.org
Fri Feb 26 06:45:50 PST 2010
Hi Pete,
It's easy to get lost in dome space - as by default the camera is at the
origin, and you can't use the mouse to move around.
I've changed the script so it sets a camera transform up looking at the
origin down the z axis, I'm also drawing the origin with show-axis which
makes it easier to get your bearings.
(clear)
(define dome (dome-build 6 180 2048))
(define myobj (with-pixels-renderer (dome-pixels)
(build-nurbs-sphere 8 10))) ; make a sphere
(with-pixels-renderer (dome-pixels)
(show-axis 1))
(define (render-spheres n)
(cond ((not (zero? n))
(with-state
(translate (vector n 0 0)) ; move in x
(draw-instance myobj)) ; stamp down a copy
(render-spheres (- n 1))))) ; recurse!
;set the view of the camera
(dome-setup-main-camera 640 480)
(with-pixels-renderer (dome-pixels)
(set-camera (mtranslate (vector 0 -1 -10))))
(every-frame
(with-pixels-renderer (dome-pixels)
(with-state
(render-spheres 10)))) ; draw 10 copies
On Fri, 2010-02-26 at 14:16 +0000, Pete Carss wrote:
> Hello all,
> I've been corresponding with Dave, preparing for an even in our dome
> on Saturday. I'm having trouble with instancing when used in
> combination with (dome-pixels) - it was suggested that the
> conversation was better suited to this list...
>
>
>
>
> (require fluxus-017/planetarium)
>
>
> (define dome (dome-build 6 180 2048))
>
>
> (define myobj (with-pixels-renderer (dome-pixels)
> (build-nurbs-sphere 8 10))) ; make a sphere
>
>
> (define (render-spheres n)
> (cond ((not (zero? n))
> (with-state
> (translate (vector n 0 0)) ; move in x
> (draw-instance myobj)) ; stamp down a copy
> (render-spheres (- n 1))))) ; recurse!
>
>
> ;set the view of the camera
> (dome-setup-main-camera 1400 1050)
>
>
> (every-frame
> (with-pixels-renderer (dome-pixels)
> (translate (vector 0 100 -100))
> (render-spheres 10))) ; draw 10 copies
>
>
>
>
> This is an example, which includes adding (with-pixels-renderer) to
> the definition of myobj, but I get no spheres at all now...?
>
>
>
>
> Pete
More information about the Fluxus
mailing list