but for the sake of completeness, how would I do that?
; create a pixel primitive with rendering enabled
(define pp (build-pixels 512 512 #t))
; hide it
(with-primitive pp
    (scale 0))

; render the camera texture in pixel primitive
(with-pixels-renderer pp
    (scale #(20 16 1)) ; scale it up to fill the whole render buffer
    (hint-unlit)
    (with-primitive (build-plane)
        (texture vt)
        ; set texture coordinates for rectangular npot camera image
        (let ([tcoords (camera-tcoords vt)])
            (pdata-index-map!
                (lambda (i t)
                    (list-ref tcoords (remainder i 4)))
                "t"))))

then you can use the pixel primitive as texture like this:
(texture (pixels->texture pp))

the texture coordinates here will be from 0,0 to 1,1, so you don't need the texture coordinate magic. this way they wrap around, which eliminates the noise.

best,
gabor

Reply via email to