summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Thompson <dthompson2@worcester.edu>2015-03-11 22:15:38 -0400
committerDavid Thompson <dthompson2@worcester.edu>2015-03-11 22:27:25 -0400
commit68fc1480bfcd38747e1cf27943e6dbd3e63e37b9 (patch)
treef96f0d2eb98ade1f4b06142a25b77545f8f0d01f
parent09fd03e14729ea929ecc3428ccfe091fa8c8deba (diff)
render: utils: Improve apply-blend-mode.
* sly/render/utils.scm (apply-blend-mode): Enable/disable blending when necessary.
-rw-r--r--sly/render/utils.scm11
1 files changed, 8 insertions, 3 deletions
diff --git a/sly/render/utils.scm b/sly/render/utils.scm
index 0146b49..802eca7 100644
--- a/sly/render/utils.scm
+++ b/sly/render/utils.scm
@@ -26,7 +26,7 @@
#:use-module (ice-9 match)
#:use-module (srfi srfi-9)
#:use-module (gl low-level)
- #:use-module (gl enums)
+ #:use-module (gl)
#:export (make-blend-mode blend-mode?
blend-mode-source blend-mode-destination
default-blend-mode
@@ -78,5 +78,10 @@
('one-minus-constant-alpha 32772)))
(define (apply-blend-mode blend-mode)
- (glBlendFunc (source-blend-function (blend-mode-source blend-mode))
- (destination-blend-function (blend-mode-destination blend-mode))))
+ (if blend-mode
+ (begin
+ (gl-enable (enable-cap blend))
+ (glBlendFunc (source-blend-function (blend-mode-source blend-mode))
+ (destination-blend-function
+ (blend-mode-destination blend-mode))))
+ (gl-disable (enable-cap blend))))