summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <davet@gnu.org>2015-06-06 14:49:26 -0400
committerDavid Thompson <davet@gnu.org>2015-06-06 14:49:26 -0400
commit3f301f0ba372cd07167b51943a48b4683f20b88c (patch)
tree912b04ff9fa89ed68114c7204ca0a8138e6672d4
parentfc6b4fb4ba04ed93acc545a52505f26dfc9198e8 (diff)
render: framebuffer: Tweak interface.
* sly/render/framebuffer.scm (null-framebuffer): New variable. (apply-framebuffer): New procedure. (with-framebuffer): Delete.
-rw-r--r--sly/render/framebuffer.scm15
1 files changed, 8 insertions, 7 deletions
diff --git a/sly/render/framebuffer.scm b/sly/render/framebuffer.scm
index bf9f84b..c3af36a 100644
--- a/sly/render/framebuffer.scm
+++ b/sly/render/framebuffer.scm
@@ -33,7 +33,8 @@
framebuffer?
framebuffer-id framebuffer-renderbuffer-id
framebuffer-texture
- with-framebuffer))
+ null-framebuffer
+ apply-framebuffer))
(define (generate-framebuffer)
"Generate a new OpenGL framebuffer object."
@@ -54,6 +55,9 @@
(renderbuffer-id framebuffer-renderbuffer-id)
(texture framebuffer-texture))
+(define null-framebuffer
+ (%make-framebuffer 0 0 #f))
+
(define make-framebuffer
(let ((draw-buffers (u32vector (version-3-0 color-attachment0))))
(lambda (width height)
@@ -110,9 +114,6 @@ dimensions WIDTH x HEIGHT."
texture-id #f width height 0 0 1 1)))
(%make-framebuffer framebuffer-id renderbuffer-id texture))))))
-(define-syntax-rule (with-framebuffer fb body ...)
- (begin
- (glBindFramebuffer (version-3-0 framebuffer)
- (framebuffer-id fb))
- body ...
- (glBindFramebuffer (version-3-0 framebuffer) 0)))
+(define (apply-framebuffer framebuffer)
+ (glBindFramebuffer (version-3-0 framebuffer)
+ (framebuffer-id framebuffer)))