Change effectwidget to work with bg alpha

This commit is contained in:
Alexander Taylor 2014-06-07 17:34:44 +01:00
parent 02b2ff7deb
commit e71f8381fc
1 changed files with 8 additions and 3 deletions

View File

@ -647,7 +647,7 @@ class EffectWidget(RelativeLayout):
with self.fbo:
ClearColor(0, 0, 0, 0)
ClearBuffers()
Color(*self.background_color)
self._background_color = Color(*self.background_color)
self.fbo_rectangle = Rectangle(size=self.size)
with self.fbo.after:
PopMatrix()
@ -657,10 +657,14 @@ class EffectWidget(RelativeLayout):
Clock.schedule_interval(self._update_glsl, 0)
self.bind(size=self.refresh_fbo_setup,
effects=self.refresh_fbo_setup)
effects=self.refresh_fbo_setup,
background_color=self._refresh_background_color)
self.refresh_fbo_setup()
def _refresh_background_color(self, *args):
self._background_color.rgba = self.background_color
def _update_glsl(self, *largs):
'''(internal) Passes new time and resolution uniform
variables to the shader.
@ -683,8 +687,9 @@ class EffectWidget(RelativeLayout):
with self.canvas:
new_fbo = EffectFbo(size=self.size)
with new_fbo:
ClearColor(1, 1, 1, 1)
ClearColor(0, 0, 0, 0)
ClearBuffers()
Color(1, 1, 1, 1)
new_fbo.texture_rectangle = Rectangle(size=self.size)
new_fbo.texture_rectangle.size = self.size