From 5ff661f1e191ce486000b727d6c979779e24efe8 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Sun, 4 Oct 2020 13:00:20 -0400 Subject: 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. --- chickadee/graphics/framebuffer.scm | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) 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 -- cgit v1.2.3