Beispiel #1
0
    def link(self):
        LinkProgram(self._object)
        _check_errors()

        self._attribs = ProgramAttributes(self)
        self._uniforms = ProgramUniforms(self)
        return self.link_status
Beispiel #2
0
 def image(self, image):
     with PreserveTextureBinding(self):
         self._bind()
         _check_errors()
         self._image = image
         self._image.submit(self._binding)
         _check_errors()
Beispiel #3
0
 def __init__(self):
     self._texture = _gen_texture()
     _check_errors()
     self._unit = None
     self._image = None
     self.filter = Filter(self)
     self.wrap = WrapMode(self)
Beispiel #4
0
 def __set__(self, instance, value):
     texture = self._get_texture(instance)
     with PreserveTextureBinding(texture) as binding:
         binding.state = texture._texture  #FIXME: binding.state ? clean enough?
         TexParameter(texture._binding, self._parameter,
                      value.value)  #FIXME: what if it's not a GLenum?
         _check_errors()
Beispiel #5
0
    def link(self):
        LinkProgram(self._object)
        _check_errors()

        self._attribs = ProgramAttributes(self)
        self._uniforms = ProgramUniforms(self)
        return self.link_status
Beispiel #6
0
 def __init__(self):
     self._texture = _gen_texture()
     _check_errors()
     self._unit = None
     self._image = None
     self.filter = Filter(self)
     self.wrap = WrapMode(self)
Beispiel #7
0
 def image(self, image):
     with PreserveTextureBinding(self):
         self._bind()
         _check_errors()
         self._image = image
         self._image.submit(self._binding)
         _check_errors()
Beispiel #8
0
 def sources(self, sources):
     #FIXME: looking at that for a second time, that is UGLY
     c_str_array = (c_str * len(sources))(*[
         c_str(''.join(source)) if hasattr(source, 'read') else c_str(source
                                                                      )
         for source in sources
     ])
     ShaderSource(self._object, len(sources), c_str_array,
                  cast(NULL, POINTER(GLuint)))
     _check_errors()
Beispiel #9
0
 def sources(self, sources):
     #FIXME: looking at that for a second time, that is UGLY
     c_str_array = (c_str * len(sources))(*[
                                             c_str(''.join(source)) if hasattr(source, 'read')
                                                 else c_str(source)
                                                     for source in sources
                                           ])
     ShaderSource(self._object,
                  len(sources),
                  c_str_array,
                  cast(NULL, POINTER(GLuint))
                 )
     _check_errors()
Beispiel #10
0
 def compile(self):
     CompileShader(self._object)
     _check_errors()
     return self.compile_status
Beispiel #11
0
 def use(self):
     UseProgram(self._object)
     _check_errors()
Beispiel #12
0
 def _set_unit(self):
     ActiveTexture(self.unit)
     _check_errors()
Beispiel #13
0
def _get_integer(flag):
    value = GLint(0)
    GetInteger(flag, value)
    _check_errors()
    return value.value
Beispiel #14
0
 def enable(self):
     self._set_unit()
     _check_errors()
     Enable(self._binding)
     _check_errors()       #FIXME: check after everything?
Beispiel #15
0
 def disable(self):
     self._set_unit()
     _check_errors()
     Disable(self._binding)
     _check_errors()
Beispiel #16
0
 def __get__(self, instance, owner):
     texture = GLint(0) #FIXME: textures are GLuints... but GetInteger is integers only
     GetInteger(_query_from_binding(self._get_binding(instance)), texture)
     _check_errors()
     return texture.value
Beispiel #17
0
    def append(self, shader):
        self._shaders.append(shader)

        AttachShader(self._program._object, shader._object)
        _check_errors()
Beispiel #18
0
def _get_integer(flag):
    value = GLint(0)
    GetInteger(flag, value)
    _check_errors()
    return value.value
Beispiel #19
0
    def append(self, shader):
        self._shaders.append(shader)

        AttachShader(self._program._object, shader._object)
        _check_errors()
Beispiel #20
0
 def __get__(self, instance, owner):
     texture = GLint(
         0)  #FIXME: textures are GLuints... but GetInteger is integers only
     GetInteger(_query_from_binding(self._get_binding(instance)), texture)
     _check_errors()
     return texture.value
Beispiel #21
0
 def _set_unit(self):
     ActiveTexture(self.unit)
     _check_errors()
Beispiel #22
0
 def disable(self):
     self._set_unit()
     _check_errors()
     Disable(self._binding)
     _check_errors()
Beispiel #23
0
 def compile(self):
     CompileShader(self._object)
     _check_errors()
     return self.compile_status
Beispiel #24
0
 def __set__(self, instance, value):
     BindTexture(self._get_binding(instance), value)
     _check_errors()
Beispiel #25
0
 def remove(self, shader):
     DetachShader(self._program._object,
                  shader._object)
     _check_errors()
Beispiel #26
0
 def enable(self):
     self._set_unit()
     _check_errors()
     Enable(self._binding)
     _check_errors()  #FIXME: check after everything?
Beispiel #27
0
 def remove(self, shader):
     DetachShader(self._program._object, shader._object)
     _check_errors()
Beispiel #28
0
 def __set__(self, instance, value):
     BindTexture(self._get_binding(instance), value)
     _check_errors()
Beispiel #29
0
 def use(self):
     UseProgram(self._object)
     _check_errors()
Beispiel #30
0
 def __set__(self, instance, value):
     texture = self._get_texture(instance)
     with PreserveTextureBinding(texture) as binding:
         binding.state = texture._texture #FIXME: binding.state ? clean enough?
         TexParameter(texture._binding, self._parameter, value.value) #FIXME: what if it's not a GLenum?
         _check_errors()