hi Hugo,

welcome to the list.

From what I understand so far, this is the best philosophy: "building"
the primitives rather than "drawing" them every-time.
i would suggest that you use draw primitives first until you are familiar with them.

Doing that every-frame will grow the primitive too large to display in
the window, so it mans that this scale of 1.2 is 'multiplied' against the
primitives current scale factor.
yes, because built primitives remember their transformation that you can reset with (identity) as you have already figured out.

As a workaround, I have tried to maintain an array of 'sizes' that I
there are a number of ways you can solve your problem, but probably this is the simplest.

here's a small example that might help.

-----

(clear)

(define count 10)

; build list of random rotations, positions, sizes
(define rotations (build-list count (lambda (n) (vmul (crndvec) 180))))
(define positions (build-list count (lambda (n) (vmul (crndvec) 5))))
(define sizes (build-list count (lambda (n) (rndf))))

(define (animate)
    ; recalculate sizes
    (set! sizes
        (map
            (lambda (s)
                (if (> s 5)
                    1
                    (+ s .1)))
            sizes))

    ; draw
    (for-each
        (lambda (r p s)
            (with-state
                (translate p)
                (rotate r)
                (scale s)
                (draw-cube)))
        rotations
        positions
        sizes))

(every-frame (animate))

-----

best,
gabor


Reply via email to