summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm15
1 files changed, 10 insertions, 5 deletions
diff --git a/chickadee.scm b/chickadee.scm
index 8250e19..0a9b0b3 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -31,6 +31,8 @@
#:use-module (chickadee render gpu)
#:use-module (chickadee render viewport)
#:use-module (chickadee utils)
+ #:use-module (gl)
+ #:use-module (gl enums)
#:use-module (ice-9 match)
#:use-module (sdl2)
#:use-module (sdl2 events)
@@ -237,7 +239,11 @@ border is disabled, otherwise it is enabled.")
(default-viewport (make-viewport 0 0 window-width window-height))
(default-projection (orthographic-projection 0 window-width
window-height 0
- 0 1)))
+ 0 1))
+ (clear-mask (logior (attrib-mask color-buffer)
+ (attrib-mask depth-buffer)
+ (attrib-mask stencil-buffer)
+ (attrib-mask accum-buffer))))
(define (invert-y y)
;; SDL's origin is the top-left, but our origin is the bottom
;; left so we need to invert Y coordinates that SDL gives us.
@@ -308,10 +314,9 @@ border is disabled, otherwise it is enabled.")
;; Free any GPU resources that have been GC'd.
(gpu-reap!))
(define (render-sdl-opengl alpha)
- ;; Switch to the null viewport to ensure that
- ;; the default viewport will be re-applied and
- ;; clear the screen.
- (set-gpu-viewport! gpu null-viewport)
+ ;; Switch to the default viewport so we can clear the whole screen.
+ (set-gpu-viewport! gpu default-viewport)
+ (gl-clear clear-mask)
(with-viewport default-viewport
(with-projection default-projection
(draw alpha)))