Пример #1
0
 def loadImage(self, imageName):
     im = Image.open(imageName)
     ix, iy, image = im.size[0], im.size[1], im.tobytes()
     ID = glGenTextures(1)
     glBindTexture(GL_TEXTURE_2D, ID)
     glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ix, iy, 0,GL_RGBA, GL_UNSIGNED_BYTE, image)
     return ID
Пример #2
0
 def __init__(self, filename):
     image = pygame.image.load(filename)
     data = pygame.image.tostring(image, 'RGBX', 1)
     
     self.__texture = glGenTextures(1)
     glBindTexture(GL_TEXTURE_2D, int(self.__texture))
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, image.get_width(), image.get_height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST)
     glTexParameterf(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST)
Пример #3
0
 def __init__(self, width, height, data):
     '''
     Inicializa una textura a partir de los datos en bruto de una imagen en formato RGBA
     '''
     
     textureId = glGenTextures(1)
     glBindTexture(GL_TEXTURE_2D, textureId)
     glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, data)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR)
     glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR)
     
     self.__textureId = textureId
    def loadImage(self):
        if self.skin == 0:
            im = Image.open("img/Flores1.png")
        elif self.skin == 1:
            im = Image.open("img/Flores2.png")
        elif self.skin == 2:
            im = Image.open("img/Flores3.png")

        ix, iy, image = im.size[0], im.size[1], im.tobytes()

        ID = glGenTextures(1)
        glBindTexture(GL_TEXTURE_2D, ID)
        glPixelStorei(GL_UNPACK_ALIGNMENT, 1)
        glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, ix, iy, 0, GL_RGBA,
                     GL_UNSIGNED_BYTE, image)
        return ID