Home | Trees | Indices | Help |
|
---|
|
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.
Instance Methods | |||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
Properties | |
Inherited from |
Method Details |
x.__init__(...) initializes x; see x.__class__.__doc__ for signature
|
Put numpy array or PIL Image into OpenGL as texture data. The texel_data parameter contains the texture data. If it is a numpy 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 numpy 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 numpy arrays: texel_data is (re)cast to UInt8 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. |
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. |
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. |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0beta1 on Sat Jun 7 09:06:47 2008 | http://epydoc.sourceforge.net |