NvUITexture Class Reference

Abstraction of a GL texture object, allowing for texture caching, lookup, and reuse/refcounting. More...

#include <NvUI.h>

List of all members.

Public Member Functions

 NvUITexture (const std::string &texname, bool noMips=true)
 Constructor for texture loaded from filename; may load from/to the texture cache.
 NvUITexture (const uint32_t texID, bool alpha, int32_t srcw, int32_t srch, bool ownsID=false, bool isCubeMap=false)
 Constructor for texture loaded from existing GL tex ID; texture cache is not involved.
virtual ~NvUITexture ()
 Default destructor, helps with refcounting and cleanup of owned textures.
int32_t GetWidth ()
 Accessor for texture width.
int32_t GetHeight ()
 Accessor for texture height.
uint32_t GetGLTex ()
 Accessor for GL texture object ID.
bool GetHasAlpha ()
 Accessor for whether texture was flagged as having alpha channel.
void AddRef ()
 Add reference to this texture.
void DelRef ()
 Subtract a reference from this texture/.

Static Public Member Functions

static NvUITextureCacheTexture (const std::string &texname, bool noMips=true)
 Static method for loading textures via internal cache.

Protected Attributes

std::string m_filename
 The requested bitmap filename, used in hashing and debugging.
uint32_t m_glID
 The GL texture ID allocated for our texture upload.
int32_t m_width
 The loaded texture width.
int32_t m_height
 The loaded texture height.
bool m_validTex
 Flag for whether this texture is a null object or was successfully loaded.
bool m_hasAlpha
 Flag for if this texture has data with an alpha channel.
bool m_ownsID
 Flag if we own the GL texture ID/object, or if someone else does.
uint32_t m_refcount
 Trivial internal refcount of a given texture object.
bool m_cached
 Whether or not the texture is cached in our master NvUITexture table.


Detailed Description

Abstraction of a GL texture object, allowing for texture caching, lookup, and reuse/refcounting.

In addition, it stores a set of 'knowledge' about the texture data loaded in the GL object, including things like the source filename and dimensions.


Constructor & Destructor Documentation

NvUITexture::NvUITexture ( const std::string &  texname,
bool  noMips = true 
)

Constructor for texture loaded from filename; may load from/to the texture cache.

NvUITexture::NvUITexture ( const uint32_t  texID,
bool  alpha,
int32_t  srcw,
int32_t  srch,
bool  ownsID = false,
bool  isCubeMap = false 
)

Constructor for texture loaded from existing GL tex ID; texture cache is not involved.

virtual NvUITexture::~NvUITexture (  )  [virtual]

Default destructor, helps with refcounting and cleanup of owned textures.


Member Function Documentation

void NvUITexture::AddRef (  )  [inline]

Add reference to this texture.

static NvUITexture* NvUITexture::CacheTexture ( const std::string &  texname,
bool  noMips = true 
) [static]

Static method for loading textures via internal cache.

First tries to find existing object in the cache. If not found in the cache, tries to load from disk, and if successful then store in the cache for later load attempts.

uint32_t NvUITexture::GetGLTex (  )  [inline]

Accessor for GL texture object ID.

bool NvUITexture::GetHasAlpha (  )  [inline]

Accessor for whether texture was flagged as having alpha channel.

int32_t NvUITexture::GetHeight (  )  [inline]

Accessor for texture height.

int32_t NvUITexture::GetWidth (  )  [inline]

Accessor for texture width.


Member Data Documentation

bool NvUITexture::m_cached [protected]

Whether or not the texture is cached in our master NvUITexture table.

std::string NvUITexture::m_filename [protected]

The requested bitmap filename, used in hashing and debugging.

uint32_t NvUITexture::m_glID [protected]

The GL texture ID allocated for our texture upload.

bool NvUITexture::m_hasAlpha [protected]

Flag for if this texture has data with an alpha channel.

int32_t NvUITexture::m_height [protected]

The loaded texture height.

bool NvUITexture::m_ownsID [protected]

Flag if we own the GL texture ID/object, or if someone else does.

uint32_t NvUITexture::m_refcount [protected]

Trivial internal refcount of a given texture object.

bool NvUITexture::m_validTex [protected]

Flag for whether this texture is a null object or was successfully loaded.

int32_t NvUITexture::m_width [protected]

The loaded texture width.


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