def loadRaw(self, size, string, format, components): """Load a raw image from the given string. 'format' is a constant such as GL_RGB or GL_RGBA that can be passed to gluBuild2DMipmaps. """ self.pixelSize = size self.size = (1.0, 1.0) self.format = format self.components = components (w, h) = size Texture.bind(self) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) if self.useMipmaps: gluBuild2DMipmaps(self.glTarget, components, w, h, format, GL_UNSIGNED_BYTE, string) else: glTexImage2D(self.glTarget, 0, components, w, h, 0, format, GL_UNSIGNED_BYTE, string)
def loadSubRaw(self, size, position, string, format): Texture.bind(self) glPixelStorei(GL_UNPACK_ALIGNMENT, 1) glTexSubImage2D(self.glTarget, 0, position[0], position[1], size[0], size[1], format, GL_UNSIGNED_BYTE, string)