Merge pull request #2242 from inclement/efw_fixes

Fixed effectwidget colour and translation problems
This commit is contained in:
Akshay Arora 2014-06-07 21:01:11 +05:30
commit 903d545780
2 changed files with 6 additions and 12 deletions

View File

@ -113,6 +113,9 @@
pos: self.center_x - self.norm_image_size[0] / 2., self.center_y - self.norm_image_size[1] / 2.
<EffectWidget>:
canvas.before:
Translate:
xy: -self.x, -self.y
canvas:
Color:
rgba: 1, 1, 1, 1

View File

@ -644,11 +644,10 @@ class EffectWidget(RelativeLayout):
with self.fbo.before:
PushMatrix()
self.fbo_translation = Translate(-self.x, -self.y, 0)
with self.fbo:
ClearColor(1, 1, 1, 1)
Color(*self.background_color)
ClearColor(0, 0, 0, 0)
ClearBuffers()
Color(*self.background_color)
self.fbo_rectangle = Rectangle(size=self.size)
with self.fbo.after:
PopMatrix()
@ -657,18 +656,11 @@ class EffectWidget(RelativeLayout):
Clock.schedule_interval(self._update_glsl, 0)
self.bind(pos=self._update_translation,
size=self.refresh_fbo_setup,
self.bind(size=self.refresh_fbo_setup,
effects=self.refresh_fbo_setup)
self.refresh_fbo_setup()
def _update_translation(self, *args):
'''(internal) Makes sure everything is translated correctly to
appear in the fbo.'''
self.fbo_translation.x = -self.x
self.fbo_translation.y = -self.y
def _update_glsl(self, *largs):
'''(internal) Passes new time and resolution uniform
variables to the shader.
@ -692,7 +684,6 @@ class EffectWidget(RelativeLayout):
new_fbo = EffectFbo(size=self.size)
with new_fbo:
ClearColor(1, 1, 1, 1)
Color(*self.background_color)
ClearBuffers()
new_fbo.texture_rectangle = Rectangle(size=self.size)