Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members | Tutorials

# irr::video::ITexture Class Reference

Interface of a Video Driver dependent Texture. More...

`#include <ITexture.h>`

Inheritance diagram for irr::video::ITexture:

List of all members.

## Public Member Functions
virtual ECOLOR_FORMAT | getColorFormat () const =0
| Get the color format of texture.
virtual E_DRIVER_TYPE | getDriverType () const =0
| Get driver type of texture.
const io::path & | getName () const
| Get name of texture (in most cases this is the filename).
virtual const core::dimension2d< u32 > & | getOriginalSize () const =0
| Get original size of the texture.
virtual u32 | getPitch () const =0
| Get pitch of texture (in bytes).
virtual const core::dimension2d< u32 > & | getSize () const =0
| Get dimension (=size) of the texture.
virtual bool | hasAlpha () const
| Returns if the texture has an alpha channel.
virtual bool | hasMipMaps () const
| Check whether the texture has MipMaps.
virtual bool | isRenderTarget () const
| Check whether the texture is a render target.
| ITexture (const io::path &name)
| constructor
virtual void * | lock (bool readOnly=false)=0
| Lock function.
virtual void | regenerateMipMapLevels ()=0
| Regenerates the mip map levels of the texture.
virtual void | unlock ()=0
| Unlock function. Must be called after a lock() to the texture.
## Protected Attributes
io::path | Name

## Detailed Description

Interface of a Video Driver dependent Texture.

An ITexture is created by an IVideoDriver by using IVideoDriver::addTexture or IVideoDriver::getTexture. After that, the texture may only be used by this VideoDriver. As you can imagine, textures of the DirectX and the OpenGL device will, e.g., not be compatible. An exception is the Software device and the NULL device, their textures are compatible. If you try to use a texture created by one device with an other device, the device will refuse to do that and write a warning or an error message to the output buffer.

Definition at line 100 of file ITexture.h.

## Constructor & Destructor Documentation

irr::video::ITexture::ITexture | ( | const io::path & | name | ) | `[inline]`

constructor

Definition at line 105 of file ITexture.h.

References irr::core::string< T, TAlloc >::make_lower(), and Name.

## Member Function Documentation

virtual ECOLOR_FORMAT irr::video::ITexture::getColorFormat | ( |  | ) | const`[pure virtual]`

Get the color format of texture.

Returns:
  The color format of texture.

Referenced by hasAlpha().

virtual E_DRIVER_TYPE irr::video::ITexture::getDriverType | ( |  | ) | const`[pure virtual]`

Get driver type of texture.

This is the driver, which created the texture. This method is used internally by the video devices, to check, if they may use a texture because textures may be incompatible between different devices.

Returns:
  Driver type of texture.

const io::path& irr::video::ITexture::getName | ( |  | ) | const`[inline]`

Get name of texture (in most cases this is the filename).

Definition at line 177 of file ITexture.h.

References Name.

virtual const core::dimension2d<u32>& irr::video::ITexture::getOriginalSize | ( |  | ) | const`[pure virtual]`

Get original size of the texture.

The texture is usually scaled, if it was created with an unoptimal size. For example if the size of the texture file it was loaded from was not a power of two. This returns the size of the texture, it had before it was scaled. Can be useful when drawing 2d images on the screen, which should have the exact size of the original texture. Use ITexture::getSize() if you want to know the real size it has now stored in the system.

Returns:
  The original size of the texture.

virtual u32 irr::video::ITexture::getPitch | ( |  | ) | const`[pure virtual]`

Get pitch of texture (in bytes).

The pitch is the amount of bytes used for a row of pixels in a texture.

Returns:
  Pitch of texture in bytes.

virtual const core::dimension2d<u32>& irr::video::ITexture::getSize | ( |  | ) | const`[pure virtual]`

Get dimension (=size) of the texture.

Returns:
  The size of the texture.

virtual bool irr::video::ITexture::hasAlpha | ( |  | ) | const`[inline, virtual]`

Returns if the texture has an alpha channel.

Definition at line 164 of file ITexture.h.

References irr::video::ECF_A1R5G5B5, irr::video::ECF_A8R8G8B8, and getColorFormat().

virtual bool irr::video::ITexture::hasMipMaps | ( |  | ) | const`[inline, virtual]`

Check whether the texture has MipMaps.

Returns:
  True if texture has MipMaps, else false.

Definition at line 161 of file ITexture.h.

virtual bool irr::video::ITexture::isRenderTarget | ( |  | ) | const`[inline, virtual]`

Check whether the texture is a render target.

Returns:
  True if this is a render target, otherwise false.

Definition at line 174 of file ITexture.h.

virtual void* irr::video::ITexture::lock | ( | bool | readOnly = `false` | ) | `[pure virtual]`

Lock function.

Locks the Texture and returns a pointer to access the pixels. After lock() has been called and all operations on the pixels are done, you must call unlock(). Locks are not accumulating, hence one unlock will do for an arbitrary number of previous locks.

Parameters:

  | readOnly | Specifies that no changes to the locked texture are made. Unspecified behavior will arise if still write access happens.

Returns:
  Returns a pointer to the pixel data. The format of the pixel can be determined by using getColorFormat(). 0 is returned, if the texture cannot be locked.

virtual void irr::video::ITexture::regenerateMipMapLevels | ( |  | ) | `[pure virtual]`

Regenerates the mip map levels of the texture.

Required after modifying the texture, usually after calling unlock().

virtual void irr::video::ITexture::unlock | ( |  | ) | `[pure virtual]`

Unlock function. Must be called after a lock() to the texture.

One should avoid to call unlock more than once before another lock.

## Member Data Documentation

io::path irr::video::ITexture::Name`[protected]`

Definition at line 181 of file ITexture.h.

Referenced by getName(), and ITexture().

The documentation for this class was generated from the following file:

- ITexture.h

| The Irrlicht Engine Documentation © 2003-2009 by Nikolaus Gebhardt. Generated on Sun Jan 10 09:24:19 2010 by Doxygen (1.5.6)