An abstract texture. More...
#include <Texture.h>
Classes | |
class | Parameters |
A set of texture parameters. More... | |
Public Member Functions | |
virtual | ~Texture () |
Destroys this texture. | |
GLuint | getId () const |
Returns the identifier of this texture. | |
unsigned int | getComponents () const |
Returns the number of components in the texture's internal format. | |
const char * | getInternalFormatName () const |
Returns the name of the texture's internal format. | |
TextureInternalFormat | getInternalFormat () const |
Returns the internal format of this texture. | |
TextureFormat | getFormat () const |
Returns a Format compatible with the internal format of this Texture. | |
bool | hasMipmaps () const |
True if this texture has any mipmap level above 0. | |
bool | isCompressed () const |
Returns true if this texture is in a compressed format on GPU. | |
GLsizei | getCompressedSize (int level) const |
Returns the size of the compressed data of this texture. | |
void | getImage (int level, TextureFormat f, PixelType t, void *pixels) |
Returns the texture pixels in the specified format. | |
void | getCompressedImage (int level, void *pixels) const |
Returns the compressed data of this texture. | |
void | generateMipMap () |
Generates the mipmap levels for this texture. | |
Protected Member Functions | |
Texture (const char *type, int target) | |
Creates a new unitialized texture. | |
void | init (TextureInternalFormat tf, const Parameters ¶ms) |
Initializes this texture. | |
GLint | bindToTextureUnit (ptr< Sampler > s, GLuint programId) const |
Binds this texture and the given sampler to a texture unit, for the given program. | |
GLint | bindToTextureUnit () const |
Binds this texture to a texture unit. | |
virtual void | swap (ptr< Texture > t) |
Swaps this texture with the given one. |
An abstract texture.
virtual ork::Texture::~Texture | ( | ) | [virtual] |
Destroys this texture.
ork::Texture::Texture | ( | const char * | type, | |
int | target | |||
) | [protected] |
Creates a new unitialized texture.
type | the texture class name. | |
target | a texture type (1D, 2D, 3D, etc). |
GLint ork::Texture::bindToTextureUnit | ( | ) | const [protected] |
Binds this texture to a texture unit.
If there is a texture unit to which no texture is currently bound the texture is bound to this unit. Otherwise the least recently used texture unit is unbound, and this texture is bound instead.
Binds this texture and the given sampler to a texture unit, for the given program.
If there is a texture unit to which no texture is currently bound the texture is bound to this unit. Otherwise the least recently used texture unit that is not used by the given program is unbound, and this texture is bound instead.
s | a sampler object to sample this texture. May be NULL. | |
programId | the program for which this texture must be bound. |
void ork::Texture::generateMipMap | ( | ) |
Generates the mipmap levels for this texture.
unsigned int ork::Texture::getComponents | ( | ) | const |
Returns the number of components in the texture's internal format.
void ork::Texture::getCompressedImage | ( | int | level, | |
void * | pixels | |||
) | const |
Returns the compressed data of this texture.
Must be used only for a compressed texture (see isCompressed).
level | the texture LOD level to be read. | |
[out] | pixels | the returned compressed data. |
GLsizei ork::Texture::getCompressedSize | ( | int | level | ) | const |
Returns the size of the compressed data of this texture.
Must be used only for a compressed texture (see isCompressed).
TextureFormat ork::Texture::getFormat | ( | ) | const |
Returns a Format compatible with the internal format of this Texture.
GLuint ork::Texture::getId | ( | ) | const |
Returns the identifier of this texture.
void ork::Texture::getImage | ( | int | level, | |
TextureFormat | f, | |||
PixelType | t, | |||
void * | pixels | |||
) |
Returns the texture pixels in the specified format.
level | the texture LOD level to be read. | |
f | the format in which data must be returned. | |
t | the type in which pixel components must be returned. | |
[out] | pixels | the returned data. |
TextureInternalFormat ork::Texture::getInternalFormat | ( | ) | const |
Returns the internal format of this texture.
const char* ork::Texture::getInternalFormatName | ( | ) | const |
Returns the name of the texture's internal format.
bool ork::Texture::hasMipmaps | ( | ) | const |
True if this texture has any mipmap level above 0.
False if this texture has only a base level.
void ork::Texture::init | ( | TextureInternalFormat | tf, | |
const Parameters & | params | |||
) | [protected] |
Initializes this texture.
tf | texture data format on GPU. | |
params | the texture parameters. |
bool ork::Texture::isCompressed | ( | ) | const |
Returns true if this texture is in a compressed format on GPU.