[Fluxus] texture-params issues?
evan.raskob [lists]
lists at lowfrequency.org
Sun Mar 8 16:22:48 PDT 2009
Hi guys,
Trying to get sorted for my performance tomorrow - running into an
issue with textures.
I'm trying to get the texture to shift by rows, without
interpolating, but can't seem to set the texture params properly.
What I want is each row in the texture image to shift a certain
amount, cleanly. Hard to describe, here's some code to show what I
mean, hopefully. (Also, I'm having a hard time getting the nurbs
plane on the screen properly... its geometry/location/scale is
different from a standard plane built using (build-plane)?)
(clear)
(clear-colour (vector 0 0 0))
(hint-unlit)
;----- load some texture
(define tex (load-texture "/Users/evan/cvs/tmpflx/fluxus/textures/
tv.png"))
;--- set params to nearest - should give pixelization instead of
smooth interpolating?
(texture-params tex (list 'min 'nearest 'mag 'nearest 'wrap-t 'clamp))
(clear-texture-cache)
;--- scale properly
(define size 16)
(define myScale 16)
(define flip 1)
(define negHscale (- (* 0.5 myScale)))
(define p (with-state
(colour (vector 0.8 0.8 0.8))
(translate (vector (* (/ 5 4) negHscale) negHscale 0))
(rotate (vector 270 0 0))
(scale (vector (* (/ 4 3) myScale) myScale myScale))
(texture tex)
(build-nurbs-plane size size)))
;----- for debugging
(with-primitive p
(pdata-index-map!
(lambda (n t)
; (printf "index: ~a, value: ~a" n t)(newline)
t)
"t"))
(define (render)
(with-primitive p
(pdata-index-map!
(lambda (n t)
(let [(r (/ (modulo n size) size))
(x (vector-ref t 0))
(y (vector-ref t 1))]
(vector (fmod (+ (* 0.005 r) x) 1) y 0)
)
)
"t"))
)
(blur 0)
(every-frame (render))
More information about the Fluxus
mailing list