def draw(self, fbo, texture): GL.glBindFramebuffer(GL.GL_FRAMEBUFFER, fbo[0]) GL.glActiveTexture(GL.GL_TEXTURE0) texture.bind() GL.glBindVertexArray(self.vertex_array[0]) GL.glDrawArrays(GL.GL_TRIANGLE_FAN, 0, 4) GL.glBindVertexArray(0) GL.glBindTexture(GL.GL_TEXTURE_2D, 0)
def __del__(self): try: GL.glDeleteBuffers(2, self.vertex_buffer) GL.glDeleteVertexArrays(1, self.vertex_array) GL.glBindTexture(GL.GL_TEXTURE_2D, 0) except: #TODO: Make sure GL objects are deleted in the correct context pass
def gl_delete(self): GL.glDeleteBuffers(2, self.vertex_buffer) GL.glDeleteVertexArrays(1, self.vertex_array) GL.glBindTexture(GL.GL_TEXTURE_2D, 0)