summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-01-21 19:29:46 -0500
committerDavid Thompson <dthompson2@worcester.edu>2021-01-26 17:12:02 -0500
commitaa45ad29efab50318d38bfd096b07021c4c7bde6 (patch)
treecb4f2347e94aa257a7906945bb5b1c389a22c93b /chickadee.scm
parent578de9a16d58385f4e9926c7c0effae6127c9270 (diff)
graphics: Rewrite rendering engine.
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm21
1 files changed, 8 insertions, 13 deletions
diff --git a/chickadee.scm b/chickadee.scm
index 3b6d6fd..82eb1b4 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -1,5 +1,5 @@
;;; Chickadee Game Toolkit
-;;; Copyright © 2018 David Thompson <davet@gnu.org>
+;;; Copyright © 2018, 2021 David Thompson <davet@gnu.org>
;;; Copyright © 2020 Peter Elliott <pelliott@ualberta.ca>
;;;
;;; Chickadee is free software: you can redistribute it and/or modify
@@ -27,10 +27,9 @@
#:use-module (chickadee config)
#:use-module (chickadee game-loop)
#:use-module (chickadee math matrix)
- #:use-module (chickadee graphics)
#:use-module (chickadee graphics color)
+ #:use-module (chickadee graphics engine)
#:use-module (chickadee graphics gl)
- #:use-module (chickadee graphics gpu)
#:use-module (chickadee graphics viewport)
#:use-module (chickadee utils)
#:use-module (gl)
@@ -281,15 +280,11 @@ border is disabled, otherwise it is enabled.")
#:height window-height
#:fullscreen? window-fullscreen?
#:multisample? #f)))
- (gpu (make-gpu (window-gl-context window)))
+ (gfx (make-graphics-engine (window-gl-context window)))
(default-viewport (make-viewport 0 0 window-width window-height))
(default-projection (orthographic-projection 0 window-width
window-height 0
- 0 1))
- (clear-mask (logior (attrib-mask color-buffer)
- (attrib-mask depth-buffer)
- (attrib-mask stencil-buffer)
- (attrib-mask accum-buffer))))
+ 0 1)))
(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.
@@ -363,10 +358,10 @@ border is disabled, otherwise it is enabled.")
;; that were queued to play this frame start playing immediately.
(update-audio)
;; Free any GPU resources that have been GC'd.
- (gpu-reap! gpu))
+ (graphics-engine-reap! gfx))
(define (render-sdl-opengl alpha)
- (with-viewport default-viewport
- (clear-screen)
+ (with-graphics-state! ((viewport default-viewport))
+ (clear-viewport)
(with-projection default-projection
(draw alpha)))
(sdl2:swap-gl-window (unwrap-window window)))
@@ -374,7 +369,7 @@ border is disabled, otherwise it is enabled.")
(const #t)
(lambda ()
(parameterize ((current-window window)
- (current-gpu gpu))
+ (current-graphics-engine gfx))
;; Attempt to activate vsync, if possible. Some systems do
;; not support setting the OpenGL swap interval.
(catch #t