Maria GDK 5.0.0.738
Documentation of native code in develop branch
Loading...
Searching...
No Matches
STK::Texture Class Referenceabstract

#include <StkTexture.h>

Inheritance diagram for STK::Texture:
Maria::SymbolTexture STK::CubeMap STK::FBODepthTexture STK::FBOTexture STK::Texture2D

Public Types

enum  LoadState { INITIAL , LOADING , LOADED , FAILED }
 

Public Member Functions

 Texture (TextureManager *tex_mgr, int texture_unit=0)
 
 Texture (int texture_unit=0)
 
GLuint getHandle () const
 
virtual void activate ()=0
 
virtual void upload ()=0
 
void deactivate (GLenum target)
 
void unload (GLenum target)
 
void setHorizontalWrap (GLenum wrap)
 
void setVerticalWrap (GLenum wrap)
 
void setAnisotropy (float anisotropy)
 
float getAnisotropy () const
 
GLenum getHorizontalWrap () const
 
GLenum getVerticalWrap () const
 
void setMinFilter (GLenum min)
 
void setMagFilter (GLenum mag)
 
GLenum getMinFilter () const
 
GLenum getMagFilter () const
 
int getTextureUnit () const
 
void setTextureUnit (int texture_unit)
 
void setStatus (LoadState state)
 
LoadState getStatus () const
 
void clear ()
 
int64_t getTimestamp () const
 

Static Public Member Functions

static int getNumActiveTextures ()
 

Protected Member Functions

void applyTextureParameters (GLenum target)
 
void getGLFormat (Image::Format fmt, GLenum &int_fmt, GLenum &data_fmt, GLenum &data_type)
 
void uploadTexture (const STK::Image &img, GLenum target)
 
virtual bool loadInternal ()=0
 

Protected Attributes

TextureManagertex_mgr_
 
GLuint handle_
 
int texture_unit_
 
GLenum vertical_wrap_
 
GLenum horizontal_wrap_
 
GLenum mag_filter_
 
GLenum min_filter_
 
GLfloat anisotropy_
 
int64_t timestamp_
 
int memsize_
 
std::atomic< int > load_state_
 

Static Protected Attributes

static int s_numActiveTextures = 0
 

Friends

class TextureLoader
 

Detailed Description

Texture - Short description. Detailed description.

Member Function Documentation

◆ activate()

virtual void STK::Texture::activate ( )
pure virtual

Activate texture. This method will upload the texture data to OpenGL if not already done, and set this texture as current texture for all texture operations on the current texture unit.

Implemented in STK::FBODepthTexture, STK::FBOTexture, Maria::SymbolTexture, STK::CubeMap, and STK::Texture2D.

◆ deactivate()

void Texture::deactivate ( GLenum  target)

Deactivates the currently bound texture. Does not delete any resources, simply unbinds the current texture handle.

◆ loadInternal()

virtual bool STK::Texture::loadInternal ( )
protectedpure virtual

Load from disk and upload to graphics card. This method should load the texture resources from disk.

Implemented in STK::FBODepthTexture, STK::FBOTexture, Maria::SymbolTexture, STK::CubeMap, and STK::Texture2D.

◆ setHorizontalWrap()

void STK::Texture::setHorizontalWrap ( GLenum  wrap)
inline

Set horizontal wrapping type.

Note
This parameter must be set before the texture is activated for the first time, else you must unload the texture and upload it again.

◆ setVerticalWrap()

void STK::Texture::setVerticalWrap ( GLenum  wrap)
inline

Set vertical wrapping type.

Note
This parameter must be set before the texture is activated for the first time, else you must unload the texture and upload it again.

◆ unload()

void Texture::unload ( GLenum  target)

Unload the texure from OpenGL. This method will unload all the texture resources related to this texture object from OpenGL.

◆ upload()

virtual void STK::Texture::upload ( )
pure virtual

Upload texture data to graphics card. This requires a valid OpenGL context. If threaded GL and shared contexts are supported this can be done from the texture loader thread.

Implemented in STK::FBODepthTexture, STK::FBOTexture, Maria::SymbolTexture, STK::CubeMap, and STK::Texture2D.


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