summaryrefslogtreecommitdiff
path: root/chickadee.scm
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2021-03-14 10:30:49 -0400
committerDavid Thompson <dthompson2@worcester.edu>2021-03-14 10:30:49 -0400
commit6c652d155fe6af7af0d151c5187b8c4ed8abba2b (patch)
treef2348002e504c5a1cf19c721b2736ce46d962401 /chickadee.scm
parent0c017ecd3491d062d63ffa2e87d9198f5fd392b2 (diff)
graphics: Rewrite with-graphics-state to use state specs.
Treating the names inside the let-like form as just symbols caused numerous bugs where a program would crash because it was trying to set graphics state that was never defined due to the relevant module never being imported. By changing with-graphics-state to require passing in the <graphics-state-spec> object, much like how parameterize works with parameter objects, it completely eliminates this type of bug. If the module containing the spec variable isn't imported, there will be an undefined variable error thrown early on. Additionally, graphics state objects needed to have a stack added to them to track previous values so that with-graphics-state could restore them later. The old trick of using let to stash the previous values no longer worked with the new macro implementation.
Diffstat (limited to 'chickadee.scm')
-rw-r--r--chickadee.scm2
1 files changed, 1 insertions, 1 deletions
diff --git a/chickadee.scm b/chickadee.scm
index 489fd0b..a8251f3 100644
--- a/chickadee.scm
+++ b/chickadee.scm
@@ -369,7 +369,7 @@ border is disabled, otherwise it is enabled.")
;; Free any GPU resources that have been GC'd.
(graphics-engine-reap! gfx))
(define (render-sdl-opengl alpha)
- (with-graphics-state! ((viewport (atomic-box-ref default-viewport)))
+ (with-graphics-state! ((g:viewport (atomic-box-ref default-viewport)))
(clear-viewport)
(with-projection (atomic-box-ref default-projection)
(draw alpha)))