summaryrefslogtreecommitdiff
path: root/chickadee/graphics/viewport.scm
diff options
context:
space:
mode:
Diffstat (limited to 'chickadee/graphics/viewport.scm')
-rw-r--r--chickadee/graphics/viewport.scm27
1 files changed, 5 insertions, 22 deletions
diff --git a/chickadee/graphics/viewport.scm b/chickadee/graphics/viewport.scm
index 4258e05..9d93c0e 100644
--- a/chickadee/graphics/viewport.scm
+++ b/chickadee/graphics/viewport.scm
@@ -22,12 +22,10 @@
(define-module (chickadee graphics viewport)
#:use-module (ice-9 match)
#:use-module (srfi srfi-9)
- #:use-module (gl)
#:use-module (chickadee utils)
#:use-module (chickadee graphics color)
#:use-module (chickadee graphics engine)
#:use-module (chickadee graphics gpu)
- #:use-module (chickadee graphics gl)
#:export (make-viewport
viewport?
viewport-rect
@@ -40,12 +38,11 @@
%default-clear-color))
(define-record-type <viewport>
- (%make-viewport rect clear-color clear-flags clear-mask)
+ (%make-viewport rect clear-color clear-flags)
viewport?
(rect viewport-rect)
(clear-color viewport-clear-color)
- (clear-flags viewport-clear-flags)
- (clear-mask viewport-clear-mask))
+ (clear-flags viewport-clear-flags))
(define %default-clear-flags '(color-buffer depth-buffer stencil-buffer))
;; Just a fun color from the Dawnbringer 32-color palette instead of
@@ -57,19 +54,6 @@
n
(error "expecting non-negative integer:" n)))
-;; TODO: This is gross. Get rid of it.
-(define clear-buffer-mask
- (memoize
- (lambda (flags)
- (apply logior
- ;; Map symbols to OpenGL constants.
- (map (match-lambda
- ('depth-buffer 256)
- ('accum-buffer 512)
- ('stencil-buffer 1024)
- ('color-buffer 16384))
- flags)))))
-
(define* (make-viewport x y width height #:key
(clear-color %default-clear-color)
(clear-flags %default-clear-flags))
@@ -84,8 +68,7 @@ CLEAR-FLAGS are 'color-buffer', 'depth-buffer', 'accum-buffer', and
(assert-non-negative-integer width)
(assert-non-negative-integer height))
clear-color
- clear-flags
- (clear-buffer-mask clear-flags)))
+ clear-flags))
(define null-viewport (make-viewport 0 0 0 0))
@@ -95,7 +78,7 @@ CLEAR-FLAGS are 'color-buffer', 'depth-buffer', 'accum-buffer', and
(clear-color (viewport-clear-color viewport)))
body ...)))
-;; TODO: Add clear buffer mask to managed gpu state.
+;; TODO: Use current viewport's clear flags.
(define (clear-viewport)
(graphics-engine-commit! (current-graphics-engine))
- (gl-clear (clear-buffer-mask %default-clear-flags)))
+ (gpu-clear-viewport %default-clear-flags))