def uniformLoc(self, var): var = compat.asciibytes(var) try: return self.__class__._uloc_[var] except: if self.program == 0: self.link() self.__class__._uloc_[var] = v = gl.glGetUniformLocationARB(self.program, var) return v
def __getattr__(self, name): prg = object.__getattribute__(self, 'prg') assert prg is ShaderProgram.shader_stack[-1] prg = prg.pid loc = self.lookup.get(name) if loc: return loc loc = glGetUniformLocationARB(prg, name) if loc == -1: raise ShaderError('No such uniform!') self.lookup[name] = loc return loc