From 68fc1480bfcd38747e1cf27943e6dbd3e63e37b9 Mon Sep 17 00:00:00 2001 From: David Thompson Date: Wed, 11 Mar 2015 22:15:38 -0400 Subject: render: utils: Improve apply-blend-mode. * sly/render/utils.scm (apply-blend-mode): Enable/disable blending when necessary. --- sly/render/utils.scm | 11 ++++++++--- 1 file 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)))) -- cgit v1.2.3