Object handle for OpenGL texture formats. More...
#include <HdlTexture.hpp>
Public Member Functions | |
HdlTextureFormat (int _width, int _height, GLenum _mode, GLenum _depth, GLenum _minFilter=GL_NEAREST, GLenum _magFilter=GL_NEAREST, GLenum _wraps=GL_CLAMP, GLenum _wrapt=GL_CLAMP, int _baseLevel=0, int _maxLevel=0) | |
HdlTextureFormat Construtor. More... | |
HdlTextureFormat (const HdlAbstractTextureFormat &fmt) | |
HdlTextureFormat Construtor. More... | |
void | setWidth (int w) |
Sets the texture's width. More... | |
void | setHeight (int h) |
Sets the texture's height. More... | |
void | setSize (int w, int h) |
Sets the format size. More... | |
void | setGLMode (GLenum md) |
Sets the texture's mode. More... | |
void | setGLDepth (GLenum dp) |
Sets the texture's pixel depth. More... | |
void | setMinFilter (GLenum mf) |
Sets the texture's minification parameter. More... | |
void | setMagFilter (GLenum mf) |
Sets the texture's magnification parameter. More... | |
void | setBaseLevel (int l) |
Sets the texture's base level for mipmaps. More... | |
void | setMaxLevel (int l) |
Sets the texture's highest level for mipmaps. More... | |
void | setSWrapping (GLenum m) |
Sets the texture's S wrapping parameter. More... | |
void | setTWrapping (GLenum m) |
Sets the texture's T wrapping parameter. More... | |
const HdlAbstractTextureFormat & | operator= (const HdlAbstractTextureFormat &) |
Copy operator. More... | |
void | setSetting (GLenum param, unsigned int value) |
Set parameter, this function will raise an Exception if any errors occur. More... | |
Public Member Functions inherited from Glip::CoreGL::HdlAbstractTextureFormat | |
int | getWidth (void) const |
int | getHeight (void) const |
int | getNumPixels (void) const |
int | getNumChannels (void) const |
int | getNumElements (void) const |
int | getAlignment (void) const |
int | getPixelSize (void) const |
virtual size_t | getRowSize (void) const |
virtual size_t | getSize (void) const |
int | getChannelDepth (void) const |
GLenum | getGLMode (void) const |
GLenum | getGLDepth (void) const |
GLenum | getMinFilter (void) const |
GLenum | getMagFilter (void) const |
int | getBaseLevel (void) const |
int | getMaxLevel (void) const |
GLenum | getSWrapping (void) const |
GLenum | getTWrapping (void) const |
bool | isCompressed (void) const |
bool | isFloatingPoint (void) const |
const HdlTextureFormatDescriptor & | getFormatDescriptor (void) const |
bool | operator== (const HdlAbstractTextureFormat &) const |
bool | operator!= (const HdlAbstractTextureFormat &) const |
bool | isCompatibleWith (const HdlAbstractTextureFormat &) const |
Check if the two formats share the same memory characteristics (sizes, number of channels, byte per pixel, internal GL mode, same mipmap levels). More... | |
HdlAbstractTextureFormat | getCompressedFormat (void) const |
Get the equivalent, but compressed, format. More... | |
HdlAbstractTextureFormat | getUncompressedFormat (void) const |
Get the equivalent, but uncompressed, format. More... | |
bool | isCorrespondingCompressedFormat (const HdlAbstractTextureFormat &) const |
Check if this and f share the same memory parameters except that the mode for f is the corresponding compressed mode of this. More... | |
virtual unsigned int | getSetting (GLenum param) const |
Obtain a setting value based on its GL name. More... | |
Static Public Member Functions | |
static HdlTextureFormat | getTextureFormat (GLuint texID) |
Obtain the format from another texture. More... | |
Static Public Member Functions inherited from Glip::CoreGL::HdlAbstractTextureFormat | |
static int | getMaxSize (void) |
Returns the maximum size for a texture. More... | |
Additional Inherited Members | |
Protected Member Functions inherited from Glip::CoreGL::HdlAbstractTextureFormat | |
HdlAbstractTextureFormat (int _width, int _height, GLenum _mode, GLenum _depth, GLenum _minFilter=GL_NEAREST, GLenum _magFilter=GL_NEAREST, GLenum _wraps=GL_CLAMP, GLenum _wrapt=GL_CLAMP, int _baseLevel=0, int _maxLevel=0) | |
HdlAbstractTextureFormat Construtor. More... | |
HdlAbstractTextureFormat (const HdlAbstractTextureFormat ©) | |
HdlAbstractTextureFormat Construtor. More... | |
void | setAlignment (int _alignment) |
Set the alignment for this format. More... | |
Object handle for OpenGL texture formats.
HdlTextureFormat::HdlTextureFormat | ( | int | _width, |
int | _height, | ||
GLenum | _mode, | ||
GLenum | _depth, | ||
GLenum | _minFilter = GL_NEAREST , |
||
GLenum | _magFilter = GL_NEAREST , |
||
GLenum | _wraps = GL_CLAMP , |
||
GLenum | _wrapt = GL_CLAMP , |
||
int | _baseLevel = 0 , |
||
int | _maxLevel = 0 |
||
) |
HdlTextureFormat Construtor.
_width | Width of the texture. |
_height | Height of the texture. |
_mode | Mode for the texture (e.g. GL_RGB, GL_RGBA, GL_BGRA, etc.). |
_depth | Depth for the texture (e.g. GL_FLOAT, GL_UNSIGNED_BYTE, GL_INT, etc.). |
_minFilter | Minification filter (e.g. GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_NEAREST or GL_LINEAR_MIPMAP_LINEAR). |
_magFilter | Magnification filter (e.g. GL_NEAREST or GL_LINEAR, only these two options are accepted). |
_wraps | Wrapping S parameter (GL_CLAMP, GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT). |
_wrapt | Wrapping T parameter (GL_CLAMP, GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT). |
_baseLevel | Base for the mipmaps (default is 0). |
_maxLevel | Highest level for the mipmaps (default is 0, no other mipmaps than the original image). |
HdlTextureFormat::HdlTextureFormat | ( | const HdlAbstractTextureFormat & | fmt | ) |
HdlTextureFormat Construtor.
fmt | Source format. |
|
static |
Obtain the format from another texture.
texID | The ID of the texture targeted (must compatible with GL_TEXTURE_2D). |
const HdlAbstractTextureFormat & HdlTextureFormat::operator= | ( | const HdlAbstractTextureFormat & | copy | ) |
Copy operator.
copy | The format to copy. |
void HdlTextureFormat::setBaseLevel | ( | int | l | ) |
Sets the texture's base level for mipmaps.
l | The new base level (must be greater than 0). |
void HdlTextureFormat::setGLDepth | ( | GLenum | dp | ) |
Sets the texture's pixel depth.
dp | The new depth for the texture (e.g. GL_FLOAT, GL_UNSIGNED_BYTE, GL_INT, etc.). |
void HdlTextureFormat::setGLMode | ( | GLenum | md | ) |
Sets the texture's mode.
md | The new mode for the texture (e.g. GL_RGB, GL_RGBA, GL_BGRA, etc.). |
void HdlTextureFormat::setHeight | ( | int | h | ) |
Sets the texture's height.
h | The new height. |
void HdlTextureFormat::setMagFilter | ( | GLenum | mf | ) |
Sets the texture's magnification parameter.
mf | The new magnification filter (e.g. GL_NEAREST or GL_LINEAR, only these two options are accepted). |
void HdlTextureFormat::setMaxLevel | ( | int | l | ) |
Sets the texture's highest level for mipmaps.
l | The new highest level (must be greater than 0). |
void HdlTextureFormat::setMinFilter | ( | GLenum | mf | ) |
Sets the texture's minification parameter.
mf | The new minification filter (e.g. GL_NEAREST, GL_LINEAR, GL_NEAREST_MIPMAP_NEAREST, GL_NEAREST_MIPMAP_LINEAR, GL_LINEAR_MIPMAP_NEAREST or GL_LINEAR_MIPMAP_LINEAR). |
void HdlTextureFormat::setSetting | ( | GLenum | param, |
unsigned int | value | ||
) |
Set parameter, this function will raise an Exception if any errors occur.
param | The GL name of the paramater to set. |
value | The value to assign to the parameter. |
Available paramaters :
Parameter | Description |
---|---|
GL_TEXTURE_WIDTH | Set the width (same as HdlTextureFormat::setWidth()). |
GL_TEXTURE_HEIGHT | Set the height (same as HdlTextureFormat::setHeight()). |
GL_TEXTURE_MIN_FILTER | Set the minification parameter (same as HdlTextureFormat::setMinFilter()). |
GL_TEXTURE_MAG_FILTER | Set the magnification parameter (same as HdlTextureFormat::setMagFilter()). |
GL_TEXTURE_WRAP_S | Set the S wrapping parameter (same as HdlTextureFormat::setSWrapping()). |
GL_TEXTURE_WRAP_T | Set the T wrapping parameter (same as HdlTextureFormat::setTWrapping()). |
GL_TEXTURE_BASE_LEVEL | Set the base mipmap level (same as HdlTextureFormat::setBaseLevel()). |
GL_TEXTURE_MAX_LEVEL | Set the base mipmap level (same as HdlTextureFormat::setMaxLevel()). |
GL_TEXTURE_INTERNAL_FORMAT | Set the mode (same as HdlTextureFormat::setGLMode()). |
GL_TEXTURE_DEPTH | Set the depth (same as HdlTextureFormat::setGLDepth()). |
void HdlTextureFormat::setSize | ( | int | w, |
int | h | ||
) |
Sets the format size.
w | The new width. |
h | The new height. |
void HdlTextureFormat::setSWrapping | ( | GLenum | m | ) |
Sets the texture's S wrapping parameter.
m | The new S wrapping parameter (e.g. GL_CLAMP, GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT) |
void HdlTextureFormat::setTWrapping | ( | GLenum | m | ) |
Sets the texture's T wrapping parameter.
m | The new T wrapping parameter (e.g. GL_CLAMP, GL_CLAMP_TO_BORDER, GL_CLAMP_TO_EDGE, GL_REPEAT, GL_MIRRORED_REPEAT) |
void HdlTextureFormat::setWidth | ( | int | w | ) |
Sets the texture's width.
w | The new width. |