#include <sglTexture.hpp>
Inheritance diagram for sglTexture::
Public Types | |
typedef void (* | callback )(sglTexture *) |
enum | WrapEnum { eREPEAT, eCLAMP, eCLAMP_TO_EDGE } |
enum | FilterEnum { eNEAREST = GL_NEAREST, eLINEAR = GL_LINEAR, eNEAREST_MIPMAP_NEAREST = GL_NEAREST_MIPMAP_NEAREST, eNEAREST_MIPMAP_LINEAR = GL_NEAREST_MIPMAP_LINEAR, eLINEAR_MIPMAP_NEAREST = GL_LINEAR_MIPMAP_NEAREST, eLINEAR_MIPMAP_LINEAR = GL_LINEAR_MIPMAP_LINEAR } |
enum | ExternalFormatEnum { eRGB = GL_RGB, eRGBA = GL_RGBA, eRED = GL_RED, eGREEN = GL_GREEN, eBLUE = GL_BLUE, eALPHA = GL_ALPHA, eLUMINANCE = GL_LUMINANCE, eLUMINANCE_ALPHA = GL_LUMINANCE_ALPHA } |
enum | TypeEnum { eBYTE = GL_BYTE, eUNSIGNED_BYTE = GL_UNSIGNED_BYTE, eSHORT = GL_SHORT, eFLOAT = GL_FLOAT, eUNSIGNED_SHORT = GL_UNSIGNED_SHORT, eINT = GL_INT, eUNSIGNED_INT = GL_UNSIGNED_INT, eBITMAP = GL_BITMAP } |
enum | InternalFormatEnum { eINT_ALPHA4 = GL_ALPHA4, eINT_LUMINANCE4 = GL_LUMINANCE4, eINT_INTENSITY4 = GL_INTENSITY4, eINT_ALPHA = GL_ALPHA, eINT_ALPHA8 = GL_ALPHA8, eINT_LUMINANCE = GL_LUMINANCE, eINT_LUMINANCE8 = GL_LUMINANCE8, eINT_LUMINANCE4_ALPHA4 = GL_LUMINANCE4_ALPHA4, eINT_LUMINANCE6_ALPHA2 = GL_LUMINANCE6_ALPHA2, eINT_INTENSITY = GL_INTENSITY, eINT_INTENSITY8 = GL_INTENSITY8, eINT_R3_G3_B2 = GL_R3_G3_B2, eINT_RGBA2 = GL_RGBA2, eINT_ALPHA12 = GL_ALPHA12, eINT_LUMINANCE12 = GL_LUMINANCE12, eINT_INTENSITY12 = GL_INTENSITY12, eINT_RGB4 = GL_RGB4, eINT_ALPHA16 = GL_ALPHA16, eINT_LUMINANCE16 = GL_LUMINANCE16, eINT_LUMINANCE_ALPHA = GL_LUMINANCE_ALPHA, eINT_LUMINANCE8_ALPHA8 = GL_LUMINANCE8_ALPHA8, eINT_LUMINANCE12_ALPHA4 = GL_LUMINANCE12_ALPHA4, eINT_INTENSITY16 = GL_INTENSITY16, eINT_RGBA4 = GL_RGBA4, eINT_RGB5_A1 = GL_RGB5_A1, eINT_LUMINANCE12_ALPHA12 = GL_LUMINANCE12_ALPHA12, eINT_RGB = GL_RGB, eINT_RGB8 = GL_RGB8, eINT_LUMINANCE16_ALPHA16 = GL_LUMINANCE16_ALPHA16, eINT_RGBA = GL_RGBA, eINT_RGBA8 = GL_RGBA8, eINT_RGB10_A2 = GL_RGB10_A2, eINT_RGB5 = GL_RGB5, eINT_RGB10 = GL_RGB10, eINT_RGB12 = GL_RGB12, eINT_RGB16 = GL_RGB16, eINT_RGBA12 = GL_RGBA12, eINT_RGBA16 = GL_RGBA16 } |
enum | CompressionLevelEnum { eCOMPRESS_NONE = 0, eCOMPRESS_MIN = 1, eCOMPRESS_MED = 2, eCOMPRESS_MAX = 3 } |
Public Methods | |
virtual | ~sglTexture () |
virtual bool | setMipmapLevels (const vector< void *> &images)=0 |
virtual bool | replaceImage (void *new_image, GLint level=0)=0 |
void | setInternalFormat (InternalFormatEnum format) |
InternalFormatEnum | getInternalFormat () const |
ExternalFormatEnum | getExternalFormat () const |
void | setCompressionLevel (CompressionLevelEnum fact) |
CompressionLevelEnum | getCompressionLevel () |
void | setLODMinMax (float minLOD, float maxLOD) |
void | getLODMinMax (float &minLOD, float &maxLOD) const |
void | setLODBaseLevel (GLuint base) |
GLuint | getLODBaseLevel () const |
void | setLODMaxLevel (GLuint maxLevel) |
GLuint | getLODMaxLevel () const |
virtual unsigned int | getIdealInternalSize () const=0 |
virtual unsigned int | getLikelyInternalSize () const=0 |
void | setBorderColor (const sglVec4f &color) |
void | getBorderColor (sglVec4f &color) const |
void | setMinFilter (FilterEnum filter) |
FilterEnum | getMinFilter () const |
void | setMagFilter (FilterEnum filter) |
FilterEnum | getMagFilter () const |
void | setMaxAnisotropy (float max) |
float | getMaxAnisotropy () const |
void | setAutoMipmapFlag (bool on) |
bool | getAutoMipmapFlag () |
bool | isValid () const |
virtual bool | checkProxy ()=0 |
virtual void | bind ()=0 |
void | unbind () |
void | reset () |
bool | isBound () const |
void | applyToUnit (sglCurrState *, unsigned int) const |
virtual bool | getSorted () const |
void | setPreBindCallback (callback func) |
callback | getPreBindCallback () const |
void | setPostBindCallback (callback func) |
callback | getPostBindCallback () const |
virtual bool | buildMipmaps (vector< void *> &mipmaps)=0 |
virtual void | printInfo (ostream &ostrm, const char *indent_string) const |
Static Public Methods | |
void | bindDirtyTextures () |
void | setAutoBind (bool on) |
bool | getAutoBind () |
unsigned int | getBitsPerTexel (InternalFormatEnum format) |
float | getMaxSupportedMaxAnisotropy () |
unsigned int | getNumComponents (ExternalFormatEnum external_format) |
Protected Types | |
enum | DirtyEnum { eDIRTY_IMAGE = 0x0001, eDIRTY_SUBIMAGE = 0x0002, eDIRTY_INTERNAL_FORMAT = 0x0004, eDIRTY_WRAP_S_MODE = 0x0008, eDIRTY_WRAP_T_MODE = 0x0010, eDIRTY_BORDER_COLOR = 0x0020, eDIRTY_MIN_FILTER = 0x0040, eDIRTY_MAG_FILTER = 0x0080, eDIRTY_MIPMAP = 0x0100, eDIRTY_ANISOTROPY = 0x0200, eDIRTY_REPLACE = 0x0400, eDIRTY_LOD = 0x0800, eDIRTY_RESET = 0x8000 } |
enum | MipStateEnum { eMIP_NONE = 0, eMIP_SW = 1, eMIP_HW = 2 } |
Protected Methods | |
sglTexture (GLenum target) | |
void | dirty (unsigned int mask) |
void | buildAutoMipmaps (unsigned int mask) |
Protected Attributes | |
const GLenum | m_target |
unsigned int | m_dirty_flag |
ExternalFormatEnum | m_external_format |
void* | m_image |
bool | m_own_image |
vector<MipmapStruct> | m_mipmaps |
GLint | m_border |
sglVec4f | m_border_color |
FilterEnum | m_mag_filter |
FilterEnum | m_min_filter |
float | m_max_anisotropy |
TypeEnum | m_type |
InternalFormatEnum | m_internal_format |
bool | m_internal_format_flag |
GLuint | m_texture_object |
bool | m_valid_flag |
MipStateEnum | m_auto_mipmap_flag |
CompressionLevelEnum | m_compression_flag |
GLenum | m_compression_enum |
bool | m_texture_lod_active |
float | m_texture_lod_min |
float | m_texture_lod_max |
GLuint | m_texture_lod_base_level |
GLuint | m_texture_lod_max_level |
bool | m_bound_mipmaps |
callback | m_pre_bind_callback |
callback | m_post_bind_callback |
unsigned int | m_internal_size |
bool | m_internal_size_dirty |
Static Protected Attributes | |
set<sglTexture *> | s_dirty_textures |
bool | s_auto_bind |
sglLock | s_lock |
Definition at line 41 of file sglTexture.hpp.
|
Callback function prototype. |
|
Texture wrap modes.
Definition at line 45 of file sglTexture.hpp. |
|
Filters used for minifying or magnifying the texture.
Definition at line 53 of file sglTexture.hpp. |
|
Valid formats for images used to create textures.
Definition at line 64 of file sglTexture.hpp. |
|
Valid data types for images used to create textures.
Definition at line 77 of file sglTexture.hpp. |
|
Possible storage formats for textures in internal display memory.
Definition at line 90 of file sglTexture.hpp. |
|
Destructor. |
|
Constructor: target = one of GL_TEXTURE_1D or GL_TEXTURE_2D |
|
Bind all textures that are currently dirty. Note that if (getAutoBind() == false), this method does nothing. This method is called by sglScene::preDraw(). |
|
Enables/Disables the bindDirtyTextures() method. default: true (dirty textures will automatically be bound by bindDirtyTextures()) |
|
Returns true if bindDirtyTextures() is enabled. |
|
Returns the ideal number of bits per texel used for the given internal texture format. |
|
Set the mipmap images. Returns false if number of images is not correct or if the AutoMipmap feature is on. Assumes that the images are correct in size and format. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Helper function to replace an entire image via subtexload funtionality. A previous image must first have been set with the setImage or setMipmapLevels methods. The new_image data must be the same size as the original image, and the pointer to the old image data is lost. The level parameter specifies which mipmap level to replace. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Request textures to be stored with the given format in internal texture memory. Note: this only a request and is not guaranteed. default: automatically determined during call to setImage |
|
Returns the requested internal texture format. Definition at line 185 of file sglTexture.hpp. |
|
Returns the current external texture format. Definition at line 188 of file sglTexture.hpp. |
|
Sets the requested compression format |
|
returns the requested compression format Definition at line 194 of file sglTexture.hpp. |
|
Sets the min/max lod to use for this texture |
|
sets the "base" level to BASE instead of zero |
|
sets the "max" level to maxLevel instead of funtion of "base" size |
|
Returns the number of bytes of texture memory this texture will use if the requested internal format was honored. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Returns the number of bytes of texture memory this texture is most likely using. Must be called by a thread with a current rendering context. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Set the color to use past the edge of a texture when CLAMP is used. default: (1.0, 1.0, 1.0, 1.0) |
|
Get the color to use past the edge of a texture when CLAMP is used. Definition at line 228 of file sglTexture.hpp. |
|
Set the filter to use for texture minification. default: eLINEAR |
|
Returns the filter to use for texture minification. Definition at line 236 of file sglTexture.hpp. |
|
Set the filter to use for texture magnification. default: eLINEAR |
|
Returns the filter to use for texture magnification. Definition at line 244 of file sglTexture.hpp. |
|
Get/set the maximum degree of anisotropy to account for in texture filtering (if supported). A value of 1.0f disables anisotropic filtering. default: 1.0f Reimplemented in sglTextureCubeMap. |
|
Get the maximum max-anisotropy supported on this system. Returns 1.0f if anisotropic filtering is not supported. Reimplemented in sglTextureCubeMap. Definition at line 258 of file sglTexture.hpp. |
|
Enable/Disable the automatic generation of mipmaps. default: false |
|
Returns true if automatic mipmap generation is on. Definition at line 267 of file sglTexture.hpp. |
|
Return status of this object (as a valid texture). if (isValid() == false) texturing will be disabled Definition at line 272 of file sglTexture.hpp. |
|
Use the GL_PROXY_TEXTURE mechanism to check if the texture is capable of being loaded into texture memory. Returns false if the texture is too large. Must be called by a thread with a current rendering context. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Copy texture (and changes) into texture memory. If (getAutoBind() == false), this method must be called before before the texture can be applied. Must be called by a thread with a current rendering context. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Removes the texture from texture memory. |
|
Dirties the texture, such that during the next bind the texture will be completely recreated in texture memory. This may be useful if the texture had mipmaps defined, but they are no longer needed. |
|
Returns true if the texture is ready to be rendered. Definition at line 298 of file sglTexture.hpp. |
|
Apply this state change to the current rendering state. NOTE: bind() should be called before calling apply(). Reimplemented from sglTexturingStatelet. |
|
Returns true if this type of statelet should be sorted by pointer rather than indexed into an array. Reimplemented from sglStatelet. Definition at line 308 of file sglTexture.hpp. |
|
Set the callback function to call before this texture is bound. This could be used to setup state like glPixelTransfer. default: NULL |
|
Returns the callback function to call before this texture is bound. Definition at line 320 of file sglTexture.hpp. |
|
Set the callback function to call after this texture is bound. This should be used to revert any state changes made by the function registered in setPreBindCallback. default: NULL |
|
Returns the callback function to call after this texture is bound. Definition at line 330 of file sglTexture.hpp. |
|
Returns the number of color components in the given external format. |
|
Generates a set of mipmaps from the level 0 image in this texture. Existing images in the given mipmaps vector will be resized (via realloc) and excess images will be free()'d. Returns false if the mipmaps could not be built. Reimplemented in sglTexture1D, sglTexture2D, and sglTextureCubeMap. |
|
Output the state of this node to the specified ostream.
Reimplemented from sglStatelet. Reimplemented in sglTexture1D, and sglTexture2D. |