Esempio n. 1
0
    def __init__(self, vertex, fragment):
        self.id = glCreateProgram()
        self.create_shader(vertex, GL_VERTEX_SHADER)
        self.create_shader(fragment, GL_FRAGMENT_SHADER)
        self.compile()
        self.bind()

        count = pointer(GLint(0))

        self.uniforms = {}
        glGetProgramiv(self.id, GL_ACTIVE_UNIFORMS, count)
        for index in range(count[0]):
            uniform = Uniform(self.id, index)
            self.uniforms[uniform.name] = uniform

        # for v in self.uniforms.values():
        #    print(v.name, v.size, v.length)

        self.unbind()
Esempio n. 2
0
    def __init__(self, vertex, fragment):
        self.id = glCreateProgram()
        self.create_shader(vertex, GL_VERTEX_SHADER)
        self.create_shader(fragment, GL_FRAGMENT_SHADER)
        self.compile()
        self.bind()

        count = pointer(GLint(0))

        self.uniforms = {}
        glGetProgramiv(self.id, GL_ACTIVE_UNIFORMS, count)
        for index in range(count[0]):
            uniform = Uniform(self.id, index)
            self.uniforms[uniform.name] = uniform

        #for v in self.uniforms.values():
        #    print(v.name, v.size, v.length)

        self.unbind()
Esempio n. 3
0
 def compile(self):
     glLinkProgram(self.id)
     status = c_int(0)
     glGetProgramiv(self.id, GL_LINK_STATUS, byref(status))
     if not status:
         raise ShaderLinkerError(get_program_log(self.id))
Esempio n. 4
0
 def compile(self):
     glLinkProgram(self.id)
     status = c_int(0)
     glGetProgramiv(self.id, GL_LINK_STATUS, byref(status))
     if not status:
         raise ShaderLinkerError(get_program_log(self.id))