summaryrefslogtreecommitdiff
path: root/silx/gui/_glutils/gl.py
diff options
context:
space:
mode:
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)