render: texture: Allow texture creation with no pixel data.
authorDavid Thompson <dthompson2@worcester.edu>
Thu, 19 Jan 2017 14:27:40 +0000 (09:27 -0500)
committerDavid Thompson <dthompson2@worcester.edu>
Thu, 19 Jan 2017 14:30:18 +0000 (09:30 -0500)
This will be useful for creating framebuffers.

chickadee/render/texture.scm

index 086caab..bdddc22 100644 (file)
@@ -21,6 +21,7 @@
   #:use-module (rnrs bytevectors)
   #:use-module (srfi srfi-9)
   #:use-module (srfi srfi-9 gnu)
+  #:use-module (system foreign)
   #:use-module (gl)
   #:use-module ((gl enums)
                 #:select (texture-min-filter texture-mag-filter)
@@ -148,7 +149,7 @@ clamp-to-edge.  FORMAT specifies the pixel format.  Currently only
                          (match format
                            ('rgba (pixel-format rgba)))
                          (color-pointer-type unsigned-byte)
-                         pixels)
+                         (or pixels %null-pointer))
     texture))
 
 (define (flip-pixels-vertically pixels width height)