MaterialX 1.39.1
|
An OpenGL texture handler class. More...
#include <GLTextureHandler.h>
Public Member Functions | |
bool | bindImage (ImagePtr image, const ImageSamplingProperties &samplingProperties) override |
Bind an image. More... | |
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 |
Release rendering resources for the given image, or for all cached images if no image pointer is specified. More... | |
int | getBoundTextureLocation (unsigned int resourceId) |
Return the bound texture location for a given resource. | |
Public Member Functions inherited from ImageHandler | |
void | addLoader (ImageLoaderPtr loader) |
Add another image loader to the handler, which will be invoked if existing loaders cannot load a given image. | |
StringSet | supportedExtensions () |
Get a list of extensions supported by the handler. | |
bool | saveImage (const FilePath &filePath, ConstImagePtr image, bool verticalFlip=false) |
Save image to disk. More... | |
ImagePtr | acquireImage (const FilePath &filePath, const Color4 &defaultColor=Color4(0.0f)) |
Acquire an image from the cache or file system. More... | |
virtual bool | bindImage (ImagePtr image, const ImageSamplingProperties &samplingProperties) |
Bind an image for rendering. More... | |
virtual bool | unbindImage (ImagePtr image) |
Unbind an image, making it no longer active for rendering. More... | |
void | unbindImages () |
Unbind all images that are currently stored in the cache. | |
void | setSearchPath (const FileSearchPath &path) |
Set the search path to be used for finding images on the file system. | |
const FileSearchPath & | getSearchPath () const |
Return the image search path. | |
void | setFilenameResolver (StringResolverPtr resolver) |
Set the filename resolver for images. | |
StringResolverPtr | getFilenameResolver () const |
Return the filename resolver for images. | |
virtual bool | createRenderResources (ImagePtr image, bool generateMipMaps, bool useAsRenderTarget=false) |
Create rendering resources for the given image. More... | |
virtual void | releaseRenderResources (ImagePtr image=nullptr) |
Release rendering resources for the given image, or for all cached images if no image pointer is specified. More... | |
void | clearImageCache () |
Clear the contents of the image cache, first releasing any render resources associated with cached images. | |
ImagePtr | getZeroImage () const |
Return a fallback image with zeroes in all channels. | |
ImageVec | getReferencedImages (ConstDocumentPtr doc) |
Acquire all images referenced by the given document, and return the images in a vector. | |
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. | |
static int | mapFilterTypeToGL (ImageSamplingProperties::FilterType filterTypeEnum, bool enableMipmaps) |
Utility to map a filter type enumeration to an OpenGL filter type. | |
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. | |
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 |
An OpenGL texture handler class.
|
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.
|
overridevirtual |
Create rendering resources for the given image.
Reimplemented from ImageHandler.
|
overridevirtual |
Release rendering resources for the given image, or for all cached images if no image pointer is specified.
Reimplemented from ImageHandler.
|
overridevirtual |
Unbind an image.
Reimplemented from ImageHandler.