Skip to content

Instantly share code, notes, and snippets.

@podhmo
Created September 26, 2010 15:33
Show Gist options
  • Save podhmo/598026 to your computer and use it in GitHub Desktop.
Save podhmo/598026 to your computer and use it in GitHub Desktop.
;; draw pixels
(add-load-path "../")
(use gl.processing)
(use graphics.imlib2)
(use util.match)
(define *image-file* "a.jpg")
(define (load)
(let1 img (load-image *image-file*)
(values (image-width img)
(image-height img)
(image-data-gl-pixels img :alpha #t))))
(define main
(receive (w h image) (load)
(setup$
(lambda ()
(gl-pixel-store GL_UNPACK_ALIGNMENT 1)
(window w h "example5" 100 100))
:reshape 2d-elastic-reshape$
:draw (draw-once$
(cut gl-draw-pixels w h GL_RGBA GL_UNSIGNED_BYTE image)))))
@podhmo
Copy link
Author

podhmo commented Sep 26, 2010

:reshape の部分(2d-elastic-reshape$ 100 100)だった。これがあると画像のサイズにあわせてオブジェクトが拡大/縮小するようにしていた。
…つもりだったけれど、gl-draw-pixelsには効果がないみたい。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment