Fix shadertree example for python3

This commit is contained in:
Alexander Taylor 2014-03-26 23:07:50 +00:00
parent 9a286c941f
commit a175df0037
1 changed files with 3 additions and 1 deletions

View File

@ -97,6 +97,7 @@ void main() {
}
'''
class ShaderWidget(FloatLayout):
# property to set the source code for fragment shader
@ -132,7 +133,7 @@ class ShaderWidget(FloatLayout):
def update_glsl(self, *largs):
self.canvas['time'] = Clock.get_boottime()
self.canvas['resolution'] = map(float, self.size)
self.canvas['resolution'] = [float(v) for v in self.size]
def on_fs(self, instance, value):
# set the fragment shader to our source code
@ -191,6 +192,7 @@ class ShaderTreeApp(App):
# shader
btn = Button(text='Change fragment shader', size_hint=(1, None),
height=50)
def change(*largs):
sw.fs = available_shaders[self.shader_index]
self.shader_index = (self.shader_index + 1) % len(available_shaders)