summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2019-11-06 17:13:41 -0500
committerDavid Thompson <dthompson2@worcester.edu>2019-11-06 17:13:41 -0500
commit5a885533855435d54359938bf163acde918d8149 (patch)
treed14c920c3aca37883a78affe5b94bca49cc262a7 /chickadee.scm
parentf00914838f1528278206e98e248c358b0404184a (diff)
Clear the screen even when nothing is being drawn.
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)))