summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2018-08-26 09:38:14 -0400
committerDavid Thompson <dthompson2@worcester.edu>2018-08-26 09:40:11 -0400
commit78f66fa3ae49181ceb0574d57eac63bd603398d9 (patch)
treeda3d7d25a008ef9085e94fb806dea75b320b3e9a
parentc64811b5430f29c15d1d9737a9a34aec80ea27a9 (diff)
Fix rendering.
-rw-r--r--starling/kernel.scm20
-rw-r--r--starling/node.scm2
2 files changed, 17 insertions, 5 deletions
diff --git a/starling/kernel.scm b/starling/kernel.scm
index 1ff6b1a..2e51712 100644
--- a/starling/kernel.scm
+++ b/starling/kernel.scm
@@ -24,7 +24,9 @@
(define-module (starling kernel)
#:use-module (chickadee)
+ #:use-module (chickadee render)
#:use-module (chickadee render gpu)
+ #:use-module (chickadee render viewport)
#:use-module (ice-9 match)
#:use-module (oop goops)
#:use-module (sdl2)
@@ -224,11 +226,13 @@
controller
(controller-axis-event-axis event)
(/ (controller-axis-event-value event) 32768.0)))))))
+ (define (poll-events)
+ (let ((event (poll-event)))
+ (when event
+ (process-event event)
+ (poll-events))))
;; Process all pending events before we update any other node.
- (let loop ((event (poll-event)))
- (when event
- (process-event event)
- (loop (poll-event))))
+ (poll-events)
;; Proceed with standard update procedure.
(next-method))
@@ -236,6 +240,14 @@
;; Free any GPU resources that have been GC'd.
(gpu-reap!))
+(define-method (render* (kernel <kernel>) alpha)
+ ;; Switch to the null viewport to ensure that
+ ;; the default viewport will be re-applied and
+ ;; clear the screen.
+ (gpu-state-set! *viewport-state* null-viewport)
+ (next-method)
+ (swap-gl-window (window kernel)))
+
(define-method (on-error (kernel <kernel>) stack key args)
(if (developer-mode? kernel)
(let ((title (window-title (window kernel))))
diff --git a/starling/node.scm b/starling/node.scm
index 00e24c6..7b0db3b 100644
--- a/starling/node.scm
+++ b/starling/node.scm
@@ -98,7 +98,7 @@ the next update represented as a ratio in the range [0, 1]."
ALPHA is the distance between the previous update and the next update
represented as a ratio in the range [0, 1]."
(render node alpha)
- (for-each-child (lambda (child) (render child alpha)) node))
+ (for-each-child (lambda (child) (render* child alpha)) node))
(define-method (on-boot (node <node>))
"Perform initialization tasks for NODE."