diff options
-rw-r--r-- | chickadee/graphics/texture.scm | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/chickadee/graphics/texture.scm b/chickadee/graphics/texture.scm index c78db50..65b7300 100644 --- a/chickadee/graphics/texture.scm +++ b/chickadee/graphics/texture.scm @@ -38,6 +38,7 @@ pixbuf->texture load-image load-cube-map + texture-copy-pixbuf! texture->pixbuf write-texture texture? @@ -467,6 +468,16 @@ are 'nearest and 'linear. By default, 'nearest is used." #:min-filter min-filter #:mag-filter mag-filter)) +(define (texture-copy-pixbuf! texture pixbuf) + "Copy the contents of PIXBUF to TEXTURE." + (with-graphics-state! ((g:texture-0 texture)) + (gl-texture-sub-image-2d (texture-target texture-2d) 0 + (texture-x texture) (texture-y texture) + (pixbuf-width pixbuf) (pixbuf-height pixbuf) + (gl-pixel-format 'rgba) + (color-pointer-type unsigned-byte) + (pixbuf-pixels pixbuf)))) + (define (texture->pixbuf texture) "Return a new pixbuf with the contents of TEXTURE." (let* ((w (texture-width texture)) |