SGCT master (487fac4)
Simple Graphics Cluster Toolkit
Loading...
Searching...
No Matches
sgct::TextureManager Class Reference

The TextureManager loads and handles textures. More...

#include <sgct/texturemanager.h>

Public Member Functions

unsigned int loadTexture (const std::filesystem::path &filename, bool interpolate=true, float anisotropicFilterSize=1.f, int mipmapLevels=8)
 Loads a texture to the TextureManager.
unsigned int loadTexture (const Image &img, bool interpolate=true, float anisotropicFilterSize=1.f, int mipmapLevels=8)
 Loads a texture to the TextureManager.
void removeTexture (unsigned int textureId)
 Removes a previously generated OpenGL texture.

Static Public Member Functions

static TextureManager & instance ()
static void destroy ()

Detailed Description

The TextureManager loads and handles textures.

It is a singleton and can be accessed anywhere using its static instance. Currently only PNG textures are supported.

Member Function Documentation

◆ destroy()

void sgct::TextureManager::destroy ( )
static

◆ instance()

TextureManager & sgct::TextureManager::instance ( )
static

◆ loadTexture() [1/2]

unsigned int sgct::TextureManager::loadTexture ( const Image & img,
bool interpolate = true,
float anisotropicFilterSize = 1.f,
int mipmapLevels = 8 )

Loads a texture to the TextureManager.

Parameters
imgThe image with the texture data
interpolateSet to true for using interpolation (bi-linear filtering)
anisotropicFilterSizeThe filter size that is used for the anisotropic filtering. If this value is 1.f, only bilinear filtering is used
mipmapLevelsThe number of mipmap levels that will be generated, setting this value to 1 or less disables mipmaps
Returns
The OpenGL name for the texture that was loaded

◆ loadTexture() [2/2]

unsigned int sgct::TextureManager::loadTexture ( const std::filesystem::path & filename,
bool interpolate = true,
float anisotropicFilterSize = 1.f,
int mipmapLevels = 8 )

Loads a texture to the TextureManager.

Parameters
filenameThe path to the texture
interpolateSet to true for using interpolation (bi-linear filtering)
anisotropicFilterSizeThe filter size that is used for the anisotropic filtering. If this value is 1.f, only bilinear filtering is used
mipmapLevelsThe number of mipmap levels that will be generated, setting this value to 1 or less disables mipmaps
Returns
The OpenGL name for the texture that was loaded

◆ removeTexture()

void sgct::TextureManager::removeTexture ( unsigned int textureId)

Removes a previously generated OpenGL texture.

Parameters
textureIdThe id of the texture that should be deleted, this has to be an id that was returned from a previous call to loadTexture

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