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)
Esempio n. 2
0
 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)
Esempio n. 3
0
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
Esempio n. 4
0
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