Skip to content

Instantly share code, notes, and snippets.

@kived
Created June 25, 2014 17:29
Show Gist options
  • Save kived/9de754ecf96456689d6f to your computer and use it in GitHub Desktop.
Save kived/9de754ecf96456689d6f to your computer and use it in GitHub Desktop.
calling gl functions
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