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