Module Texture :: Class Texture
[hide private]
[frames] | no frames]

Class Texture

source code

Represents an OpenGL texture, optionally loaded from disk in any format supported by PIL

Instance Methods [hide private]
 
__init__(self, name='', target=GL_TEXTURE_2D) source code
 
loadFile(self, name)
Load the texture from disk, using PIL to open the file
source code
 
loadImage(self, image)
Load the texture from a PIL image
source code
 
prepareRenderTarget(self, width, height, generateMipmap=True) source code
 
setAsRenderTarget(self) source code
 
resetDefaultRenderTarget(self) source code
 
nextPowerOfTwo(self, n) source code
 
loadSurface(self, surface, monochrome=True, alphaChannel=True)
Load the texture from a pygame surface
source code
 
loadSubsurface(self, surface, position=(0, 0), monochrome=True, alphaChannel=True)
Load the texture from a pygame surface
source code
 
loadRaw(self, size, string, format, components)
Load a raw image from the given string.
source code
 
loadSubRaw(self, size, position, string, format) source code
 
loadEmpty(self, size, format) source code
 
setDefaults(self)
Set the default OpenGL options for this texture
source code
 
setRepeat(self, u=GL_REPEAT, v=GL_REPEAT) source code
 
setFilter(self, min=GL_LINEAR_MIPMAP_LINEAR, mag=GL_LINEAR) source code
 
__del__(self) source code
 
bind(self, glTarget='')
Bind this texture to self.glTarget in the current OpenGL context
source code
Method Details [hide private]

loadRaw(self, size, string, format, components)

source code 
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.