Created
June 25, 2014 17:29
-
-
Save kived/9de754ecf96456689d6f to your computer and use it in GitHub Desktop.
calling gl functions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.uix.widget import Widget | |
from kivy.graphics import Callback | |
from kivy.graphics.opengl import glBlendFunc, GL_ONE_MINUS_DST_COLOR, GL_ZERO | |
class InverseColor(Widget): | |
def __init__(self, **kwargs): | |
super(InverseColor, self).__init__(**kwargs) | |
with self.canvas.before: | |
Callback(self._enable) | |
with self.canvas.after: | |
Callback(self._disable, reset_context=True) | |
def _enable(self, *_): | |
glBlendFunc(GL_ONE_MINUS_DST_COLOR, GL_ZERO) | |
def _disable(self, *_): | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment