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

Class TextureObject

object --+
         |
        TextureObject


Texture data in OpenGL. Potentially resident in video texture memory.

This class encapsulates the state variables in OpenGL texture objects.  Do not
change attribute values directly.  Use the methods provided instead.

Method Summary
  __init__(self, dimensions)
  __del__(self)
  put_new_framebuffer(self, buffer, mipmap_level, border, framebuffer_lowerleft, size, internal_format, cube_side)
Replace texture object with the framebuffer contents.
  put_new_image(self, texel_data, mipmap_level, border, check_opengl_errors, internal_format, data_format, data_type, cube_side, image_data)
Put Numeric array or PIL Image into OpenGL as texture data.
  put_sub_image(self, texel_data, mipmap_level, offset_tuple, data_format, data_type, cube_side, image_data)
Replace all or part of a texture object.
  set_border_color(self, border_color)
Set to a sequence of 4 floats in the range 0.0 to 1.0...
  set_mag_filter(self, filter)
  set_min_filter(self, filter)
  set_wrap_mode_r(self, wrap_mode)
Set to GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BORDER...
  set_wrap_mode_s(self, wrap_mode)
Set to GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BORDER...
  set_wrap_mode_t(self, wrap_mode)
Set to GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BORDER...
    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
member_descriptor __gl_module__ = <member '__gl_module__' of 'TextureObjec...
tuple __slots__ = ('min_filter', 'mag_filter', 'wrap_mode_r', ...
member_descriptor border_color = <member 'border_color' of 'TextureObject'...
member_descriptor cube_mipmap_arrays = <member 'cube_mipmap_arrays' of 'Te...
member_descriptor dimensions = <member 'dimensions' of 'TextureObject' obj...
member_descriptor gl_id = <member 'gl_id' of 'TextureObject' objects>
member_descriptor mag_filter = <member 'mag_filter' of 'TextureObject' obj...
member_descriptor min_filter = <member 'min_filter' of 'TextureObject' obj...
member_descriptor mipmap_arrays = <member 'mipmap_arrays' of 'TextureObjec...
member_descriptor target = <member 'target' of 'TextureObject' objects>
member_descriptor wrap_mode_r = <member 'wrap_mode_r' of 'TextureObject' o...
member_descriptor wrap_mode_s = <member 'wrap_mode_s' of 'TextureObject' o...
member_descriptor wrap_mode_t = <member 'wrap_mode_t' of 'TextureObject' o...

Method Details

put_new_framebuffer(self, buffer='back', mipmap_level=0, border=0, framebuffer_lowerleft=None, size=None, internal_format=6407, cube_side=None)

Replace texture object with the framebuffer contents.

The framebuffer_lowerleft parameter determines the lower left
corner of the framebuffer region from which to copy texel data
in pixel units.  For example, (0,0) would be no offset and
thus the new data would be placed from the lower left of the
framebuffer.

For an explanation of most parameters, see the
put_new_image() method.

put_new_image(self, texel_data, mipmap_level=0, border=0, check_opengl_errors=True, internal_format=6407, data_format=None, data_type=None, cube_side=None, image_data=None)

Put Numeric array or PIL Image into OpenGL as texture data.

The texel_data parameter contains the texture data.  If it is
a Numeric array, it must be 1D, 2D, or 3D data in grayscale or
color (RGB or RGBA).  Remember that OpenGL begins its textures
from the lower left corner, so texel_data[0,:] = 1.0 would set
the bottom line of the texture to white, while texel_data[:,0]
= 1.0 would set the left line of the texture to white.

The mipmap_level parameter specifies which of the texture
object's mipmap arrays you are filling.

The border parameter specifies the width of the border.

The check_opengl_errors parameter turns on (more
comprehensible) error messages when something goes wrong.  It
also slows down performance a little bit.

The internal_format parameter specifies the format in which
the image data is stored on the video card.  See the OpenGL
specification for all possible values.

If the data_format parameter is None (the default), an attempt
is made to guess data_format according to the following
description. For Numeric arrays: If texel_data.shape is equal
to the dimensions of the texture object, texel_data is assumed
to contain luminance (grayscale) information and data_format
is set to GL_LUMINANCE.  If texel_data.shape is equal to one
plus the dimensions of the texture object, texel_data is
assumed to contain color information.  If texel_data.shape[-1]
is 3, this is assumed to be RGB data and data_format is set to
GL_RGB.  If, texel_data.shape[-1] is 4, this is assumed to be
RGBA data and data_format is set to GL_RGBA. For PIL images:
the "mode" attribute is queried.

If the data_type parameter is None (the default), it is set to
GL_UNSIGNED_BYTE. For Numeric arrays: texel_data is (re)cast
as UnsignedInt8 and, if it is a floating point type, values
are assumed to be in the range 0.0-1.0 and are scaled to the
range 0-255.  If the data_type parameter is not None, the
texel_data is not rescaled or recast.  Currently only
GL_UNSIGNED_BYTE is supported. For PIL images: texel_data is
used as unsigned bytes.  This is the usual format for common
computer graphics files.

put_sub_image(self, texel_data, mipmap_level=0, offset_tuple=None, data_format=None, data_type=None, cube_side=None, image_data=None)

Replace all or part of a texture object.

This is faster that put_new_image(), and can be used to
rapidly update textures.

The offset_tuple parameter determines the lower left corner
(for 2D textures) of your data in pixel units.  For example,
(0,0) would be no offset and thus the new data would be placed
in the lower left of the texture.

For an explanation of most parameters, see the
put_new_image() method.

set_border_color(self, border_color)

Set to a sequence of 4 floats in the range 0.0 to 1.0

set_wrap_mode_r(self, wrap_mode)

Set to GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BORDER

set_wrap_mode_s(self, wrap_mode)

Set to GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BORDER

set_wrap_mode_t(self, wrap_mode)

Set to GL_CLAMP, GL_CLAMP_TO_EDGE, GL_REPEAT, or GL_CLAMP_TO_BORDER

Class Variable Details

__gl_module__

Type:
member_descriptor
Value:
<member '__gl_module__' of 'TextureObject' objects>                    

__slots__

Type:
tuple
Value:
('min_filter',
 'mag_filter',
 'wrap_mode_r',
 'wrap_mode_s',
 'wrap_mode_t',
 'border_color',
 'mipmap_arrays',
 'cube_mipmap_arrays',
...                                                                    

border_color

Type:
member_descriptor
Value:
<member 'border_color' of 'TextureObject' objects>                     

cube_mipmap_arrays

Type:
member_descriptor
Value:
<member 'cube_mipmap_arrays' of 'TextureObject' objects>               

dimensions

Type:
member_descriptor
Value:
<member 'dimensions' of 'TextureObject' objects>                       

gl_id

Type:
member_descriptor
Value:
<member 'gl_id' of 'TextureObject' objects>                            

mag_filter

Type:
member_descriptor
Value:
<member 'mag_filter' of 'TextureObject' objects>                       

min_filter

Type:
member_descriptor
Value:
<member 'min_filter' of 'TextureObject' objects>                       

mipmap_arrays

Type:
member_descriptor
Value:
<member 'mipmap_arrays' of 'TextureObject' objects>                    

target

Type:
member_descriptor
Value:
<member 'target' of 'TextureObject' objects>                           

wrap_mode_r

Type:
member_descriptor
Value:
<member 'wrap_mode_r' of 'TextureObject' objects>                      

wrap_mode_s

Type:
member_descriptor
Value:
<member 'wrap_mode_s' of 'TextureObject' objects>                      

wrap_mode_t

Type:
member_descriptor
Value:
<member 'wrap_mode_t' of 'TextureObject' objects>                      

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