summaryrefslogtreecommitdiff
path: root/silx/gui/_glutils/gl.py
diff options
context:
space:
mode:
authorPicca Frédéric-Emmanuel <picca@debian.org>2018-03-04 10:20:27 +0100
committerPicca Frédéric-Emmanuel <picca@debian.org>2018-03-04 10:20:27 +0100
commit270d5ddc31c26b62379e3caa9044dd75ccc71847 (patch)
tree55c5bfc851dfce7172d335cd2405b214323e3caf /silx/gui/_glutils/gl.py
parente19c96eff0c310c06c4f268c8b80cb33bd08996f (diff)
New upstream version 0.7.0+dfsg
Diffstat (limited to 'silx/gui/_glutils/gl.py')
-rw-r--r--silx/gui/_glutils/gl.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/silx/gui/_glutils/gl.py b/silx/gui/_glutils/gl.py
index 4b9a7bb..608d9ce 100644
--- a/silx/gui/_glutils/gl.py
+++ b/silx/gui/_glutils/gl.py
@@ -101,7 +101,10 @@ def enabled(capacity, enable=True):
:param bool enable:
True (default) to enable during context, False to disable
"""
- if enable:
+ if bool(enable) == glGetBoolean(capacity):
+ # Already in the right state: noop
+ yield
+ elif enable:
glEnable(capacity)
yield
glDisable(capacity)