Created
December 17, 2014 23:27
-
-
Save inclement/2bad65faf0db5ea67191 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| class Renderer(Widget): | |
| def __init__(self, fd, **kwargs): | |
| self.instructions = InstructionGroup() | |
| self.canvas = RenderContext(compute_normal_mat=True) | |
| self.mesh1 = RenderContext(compute_normal_mat=True) | |
| self.mesh1.shader.source = resource_find('shaders/red.glsl') | |
| self.mesh2 = RenderContext(compute_normal_mat=True) | |
| self.mesh2.shader.source = resource_find('shaders/blue.glsl') | |
| self.suzanne = ObjFileLoader(resource_find("data/monkey.obj")) | |
| self.fd = fd | |
| super(Renderer, self).__init__(**kwargs) | |
| self.instructions.add(self.baseGrid()) | |
| self.instructions.add(self.mesh1) | |
| self.instructions.add(self.mesh2) | |
| self.canvas.add(self.instructions) | |
| with self.canvas: | |
| self.cb = Callback(self.setup_gl_context) | |
| PushMatrix() | |
| PopMatrix() | |
| self.cb = Callback(self.reset_gl_context) | |
| Clock.schedule_interval(partial(self.update_glsl, fd), 1 / 60.) | |
| with self.mesh1: | |
| cb = Callback(self.setup_gl_context) | |
| with self.mesh2: | |
| cb = Callback(self.setup_gl_context) | |
| self.setupScene() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment