Package VisionEgg :: Module Textures :: Class Texture
[frames | no frames]

Class Texture

object --+
         |
        Texture

Known Subclasses:
TextureFromFile

A 2 dimensional texture.

The pixel data can come from an image file, an image file stream,
an instance of Image from the Python Imaging Library, a Numeric
Python array, or None.

If the data is a Numeric python array, floating point numbers are
assumed to be in the range 0.0 to 1.0, and integers are assumed to
be in the range 0 to 255.  The first index is the row (y
position), the second index is the column (x position), and if
it's RGB or RGBA data, the third index specifies the color band.
Thus, if the texel data was 640 pixels wide by 480 pixels tall,
the array would have shape (480,640) for luminance information,
(480,640,3) for RGB information, and (480,640,4) for RGBA
information.

The 2D texture data is not sent to OpenGL (video texture memory)
until the load() method is called.  The unload() method may be
used to remove the data from OpenGL.

A reference to the original image data is maintained.

Method Summary
  __init__(self, texels, size)
Creates instance of Texture object.
  get_pixels_as_image(self)
  get_texels_as_image(self)
Return texel data as PIL image...
  get_texture_object(self)
  load(self, texture_object, build_mipmaps, rescale_original_to_fill_texture_object, internal_format)
Load texture data to video texture memory.
  make_half_size(self)
  unload(self)
Unload texture data from video texture memory.
  update(self)
Update texture data This method does nothing, but may be overriden in classes that need to update their texture data whenever drawn.
    Inherited from object
  __delattr__(...)
x.__delattr__('name') <==> del x.name...
  __getattribute__(...)
x.__getattribute__('name') <==> x.name...
  __hash__(x)
x.__hash__() <==> hash(x)...
  __reduce__(...)
helper for pickle...
  __reduce_ex__(...)
helper for pickle...
  __repr__(x)
x.__repr__() <==> repr(x)...
  __setattr__(...)
x.__setattr__('name', value) <==> x.name = value...
  __str__(x)
x.__str__() <==> str(x)...
    Inherited from type
  __new__(T, S, ...)
T.__new__(S, ...) -> a new object with type S, a subtype of T...

Class Variable Summary
tuple __slots__ = ('texels', 'texture_object', 'size', '_filen...
member_descriptor buf_bf = <member 'buf_bf' of 'Texture' objects>
member_descriptor buf_lf = <member 'buf_lf' of 'Texture' objects>
member_descriptor buf_rf = <member 'buf_rf' of 'Texture' objects>
member_descriptor buf_tf = <member 'buf_tf' of 'Texture' objects>
member_descriptor size = <member 'size' of 'Texture' objects>
member_descriptor texels = <member 'texels' of 'Texture' objects>
member_descriptor texture_object = <member 'texture_object' of 'Texture' o...

Method Details

__init__(self, texels=None, size=None)
(Constructor)

Creates instance of Texture object.

texels -- Texture data. If not specified, a blank white
          texture is created.
size -- If a tuple, force size of texture data if possible,
        raising an exception if not. If None, has no effect.
Overrides:
__builtin__.object.__init__

get_texels_as_image(self)

Return texel data as PIL image

load(self, texture_object, build_mipmaps=True, rescale_original_to_fill_texture_object=False, internal_format=6407)

Load texture data to video texture memory.

This will cause the texture data to become resident in OpenGL
video texture memory, enabling fast drawing.

The texture_object argument is used to specify an instance of
the TextureObject class, which is a wrapper for the OpenGL
texture object holding the resident texture.

To remove a texture from OpenGL's resident textures:       TextureObject passed as the texture_object argument and 2)
call the unload() method

unload(self)

Unload texture data from video texture memory.

This only removes data from the video texture memory if there
are no other references to the TextureObject instance.  To
ensure this, all references to the texture_object argument
passed to the load() method should be deleted.

update(self)

Update texture data

This method does nothing, but may be overriden in classes that
need to update their texture data whenever drawn.

It it called by the draw() method of any stimuli using
textures when its texture object is active, so it can safely
use put_sub_image() to manipulate its own texture data.

Class Variable Details

__slots__

Type:
tuple
Value:
('texels',
 'texture_object',
 'size',
 '_filename',
 '_file_stream',
 'buf_lf',
 'buf_rf',
 'buf_bf',
...                                                                    

buf_bf

Type:
member_descriptor
Value:
<member 'buf_bf' of 'Texture' objects>                                 

buf_lf

Type:
member_descriptor
Value:
<member 'buf_lf' of 'Texture' objects>                                 

buf_rf

Type:
member_descriptor
Value:
<member 'buf_rf' of 'Texture' objects>                                 

buf_tf

Type:
member_descriptor
Value:
<member 'buf_tf' of 'Texture' objects>                                 

size

Type:
member_descriptor
Value:
<member 'size' of 'Texture' objects>                                   

texels

Type:
member_descriptor
Value:
<member 'texels' of 'Texture' objects>                                 

texture_object

Type:
member_descriptor
Value:
<member 'texture_object' of 'Texture' objects>                         

Generated by Epydoc 2.0 on Fri Sep 19 18:29:38 2003 http://epydoc.sf.net