/usr/share/pyshared/glitch/limbo/cache.py is in python-glitch 0.6-3.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | import OpenGL.GL as gl
import glitch
class Cached(glitch.Node):
def _make_display_list(self, ctx):
id = gl.glGenLists(1)
gl.glNewList(id, gl.GL_COMPILE)
self.draw(ctx)
gl.glEndList()
return id
def _cached_draw(self, ctx, key):
lists = ctx.setdefault('display_lists', {})
if key in lists:
list_id = lists[key]
else:
list_id = lists[key] = self._make_display_list(ctx)
gl.glCallList(list_id)
def render(self, ctx):
self._cached_draw(ctx, key=self.__class__)
for c in self.children:
c.render(ctx)
|