summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chickadee/render/viewport.scm21
1 files changed, 11 insertions, 10 deletions
diff --git a/chickadee/render/viewport.scm b/chickadee/render/viewport.scm
index 6789766..ad057d1 100644
--- a/chickadee/render/viewport.scm
+++ b/chickadee/render/viewport.scm
@@ -96,16 +96,17 @@ CLEAR-FLAGS are 'color-buffer', 'depth-buffer', 'accum-buffer', and
(define (apply-viewport viewport)
"Set the OpenGL state for VIEWPORT. Clip rendering to the viewport
area, set the clear color, and clear necessary buffers."
- (let ((x (viewport-x viewport))
- (y (viewport-y viewport))
- (w (viewport-width viewport))
- (h (viewport-height viewport))
- (c (viewport-clear-color viewport)))
- (gl-enable (enable-cap scissor-test))
- (gl-viewport x y w h)
- (gl-scissor x y w h)
- (gl-clear-color (color-r c) (color-g c) (color-b c) (color-a c))
- (gl-clear (clear-buffer-mask (viewport-clear-flags viewport)))))
+ (unless (eq? viewport null-viewport)
+ (let ((x (viewport-x viewport))
+ (y (viewport-y viewport))
+ (w (viewport-width viewport))
+ (h (viewport-height viewport))
+ (c (viewport-clear-color viewport)))
+ (gl-enable (enable-cap scissor-test))
+ (gl-viewport x y w h)
+ (gl-scissor x y w h)
+ (gl-clear-color (color-r c) (color-g c) (color-b c) (color-a c))
+ (gl-clear (clear-buffer-mask (viewport-clear-flags viewport))))))
(define *viewport-state*
(make-gpu-state apply-viewport null-viewport))