summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2020-10-04 13:00:20 -0400
committerDavid Thompson <dthompson2@worcester.edu>2020-10-04 13:00:20 -0400
commit5ff661f1e191ce486000b727d6c979779e24efe8 (patch)
tree4af2d900f7f3ccd2c5f9d915997ea02eff201310
parent85c32e4c1302a3c37a1ebb4cf7b4888affdc4f61 (diff)
graphics: framebuffer: Use a fully transparent clear color.
Without this it is impossible to render multiple framebuffers on top of each other and get the desired result.
-rw-r--r--chickadee/graphics/framebuffer.scm5
1 files changed, 4 insertions, 1 deletions
diff --git a/chickadee/graphics/framebuffer.scm b/chickadee/graphics/framebuffer.scm
index 967c115..091ab3f 100644
--- a/chickadee/graphics/framebuffer.scm
+++ b/chickadee/graphics/framebuffer.scm
@@ -29,6 +29,7 @@
#:use-module (gl)
#:use-module (gl enums)
#:use-module (chickadee math matrix)
+ #:use-module (chickadee graphics color)
#:use-module (chickadee graphics gl)
#:use-module (chickadee graphics gpu)
#:use-module ((chickadee graphics texture) #:select (make-texture null-texture))
@@ -84,6 +85,8 @@
(gl-bind-framebuffer (version-3-0 framebuffer)
(framebuffer-id framebuffer)))
+(define %clear-color (transparency 0.0))
+
(define make-framebuffer
(let ((draw-buffers (u32vector (version-3-0 color-attachment0))))
(lambda* (width height #:key (min-filter 'linear) (mag-filter 'linear)
@@ -103,7 +106,7 @@ dimensions WIDTH x HEIGHT."
;; rendering engine can set it whenever it changes to
;; this framebuffer, saving users the trouble of having
;; to this tedious task themselves.
- (viewport (make-viewport 0 0 width height))
+ (viewport (make-viewport 0 0 width height #:clear-color %clear-color))
(projection (orthographic-projection 0 width height 0 0 1))
(framebuffer (%make-framebuffer framebuffer-id
renderbuffer-id