def push(self, vertex, fragment): if vertex is None: vertex = [] else: vertex = [vertex] if fragment is None: fragment = [] else: fragment = [fragment] shader = Shader(vertex, fragment) shader.initialize() self.stack.append(shader)
def load_shader(name): name = name.split('.')[0] if name in cached: return cached[name] try: vert = [open('./shaders/%s.vert' % name, 'rb').read()] except: vert = [] try: frag = [open('./shaders/%s.frag' % name, 'rb').read()] except: frag = [] if not vert and not frag: shader = None else: shader = Shader(vert, frag) shader.initialize() shader = [shader] cached[name] = shader return shader