HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
GLTextureHandler Class Reference

#include <GLTextureHandler.h>

+ Inheritance diagram for GLTextureHandler:

Public Member Functions

bool bindImage (ImagePtr image, const ImageSamplingProperties &samplingProperties) override
 
bool unbindImage (ImagePtr image) override
 Unbind an image. More...
 
bool createRenderResources (ImagePtr image, bool generateMipMaps, bool useAsRenderTarget=false) override
 Create rendering resources for the given image. More...
 
void releaseRenderResources (ImagePtr image=nullptr) override
 
int getBoundTextureLocation (unsigned int resourceId)
 Return the bound texture location for a given resource. More...
 
- Public Member Functions inherited from ImageHandler
virtual ~ImageHandler ()
 
void addLoader (ImageLoaderPtr loader)
 
StringSet supportedExtensions ()
 Get a list of extensions supported by the handler. More...
 
bool saveImage (const FilePath &filePath, ConstImagePtr image, bool verticalFlip=false)
 
ImagePtr acquireImage (const FilePath &filePath, const Color4 &defaultColor=Color4(0.0f))
 
void unbindImages ()
 Unbind all images that are currently stored in the cache. More...
 
void setSearchPath (const FileSearchPath &path)
 Set the search path to be used for finding images on the file system. More...
 
const FileSearchPathgetSearchPath () const
 Return the image search path. More...
 
void setFilenameResolver (StringResolverPtr resolver)
 Set the filename resolver for images. More...
 
StringResolverPtr getFilenameResolver () const
 Return the filename resolver for images. More...
 
void clearImageCache ()
 
ImagePtr getZeroImage () const
 Return a fallback image with zeroes in all channels. More...
 
ImageVec getReferencedImages (ConstDocumentPtr doc)
 

Static Public Member Functions

static ImageHandlerPtr create (ImageLoaderPtr imageLoader)
 
static int mapAddressModeToGL (ImageSamplingProperties::AddressMode addressModeEnum)
 Utility to map an address mode enumeration to an OpenGL address mode. More...
 
static int mapFilterTypeToGL (ImageSamplingProperties::FilterType filterTypeEnum, bool enableMipmaps)
 Utility to map a filter type enumeration to an OpenGL filter type. More...
 
static void mapTextureFormatToGL (Image::BaseType baseType, unsigned int channelCount, bool srgb, int &glType, int &glFormat, int &glInternalFormat)
 Utility to map generic texture properties to OpenGL texture formats. More...
 
- Static Public Member Functions inherited from ImageHandler
static ImageHandlerPtr create (ImageLoaderPtr imageLoader)
 

Protected Member Functions

 GLTextureHandler (ImageLoaderPtr imageLoader)
 
int getNextAvailableTextureLocation ()
 
- Protected Member Functions inherited from ImageHandler
 ImageHandler (ImageLoaderPtr imageLoader)
 
ImagePtr loadImage (const FilePath &filePath)
 
void cacheImage (const string &filePath, ImagePtr image)
 
ImagePtr getCachedImage (const FilePath &filePath)
 

Protected Attributes

std::vector< unsigned int_boundTextureLocations
 
- Protected Attributes inherited from ImageHandler
ImageLoaderMap _imageLoaders
 
ImageMap _imageCache
 
FileSearchPath _searchPath
 
StringResolverPtr _resolver
 
ImagePtr _zeroImage
 

Detailed Description

An OpenGL texture handler class

Definition at line 23 of file GLTextureHandler.h.

Constructor & Destructor Documentation

GLTextureHandler::GLTextureHandler ( ImageLoaderPtr  imageLoader)
protected

Member Function Documentation

bool GLTextureHandler::bindImage ( ImagePtr  image,
const ImageSamplingProperties samplingProperties 
)
overridevirtual

Bind an image. This method will bind the texture to an active texture unit as defined by the corresponding image description. The method will fail if there are not enough available image units to bind to.

Reimplemented from ImageHandler.

static ImageHandlerPtr GLTextureHandler::create ( ImageLoaderPtr  imageLoader)
inlinestatic

Definition at line 26 of file GLTextureHandler.h.

bool GLTextureHandler::createRenderResources ( ImagePtr  image,
bool  generateMipMaps,
bool  useAsRenderTarget = false 
)
overridevirtual

Create rendering resources for the given image.

Reimplemented from ImageHandler.

int GLTextureHandler::getBoundTextureLocation ( unsigned int  resourceId)

Return the bound texture location for a given resource.

int GLTextureHandler::getNextAvailableTextureLocation ( )
protected
static int GLTextureHandler::mapAddressModeToGL ( ImageSamplingProperties::AddressMode  addressModeEnum)
static

Utility to map an address mode enumeration to an OpenGL address mode.

static int GLTextureHandler::mapFilterTypeToGL ( ImageSamplingProperties::FilterType  filterTypeEnum,
bool  enableMipmaps 
)
static

Utility to map a filter type enumeration to an OpenGL filter type.

static void GLTextureHandler::mapTextureFormatToGL ( Image::BaseType  baseType,
unsigned int  channelCount,
bool  srgb,
int glType,
int glFormat,
int glInternalFormat 
)
static

Utility to map generic texture properties to OpenGL texture formats.

void GLTextureHandler::releaseRenderResources ( ImagePtr  image = nullptr)
overridevirtual

Release rendering resources for the given image, or for all cached images if no image pointer is specified.

Reimplemented from ImageHandler.

bool GLTextureHandler::unbindImage ( ImagePtr  image)
overridevirtual

Unbind an image.

Reimplemented from ImageHandler.

Member Data Documentation

std::vector<unsigned int> GLTextureHandler::_boundTextureLocations
protected

Definition at line 67 of file GLTextureHandler.h.


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