iv::GlTexture Class Reference

#include <GlTexture.hpp>

Public Member Functions

 GlTexture ()
 
void CreateTexture (Context const *logger, RenderTarget *target, int2 size, GlMinFiltering, GlMagFiltering, bool repeat, PixelFormat storage_format, ColorSpace color_space)
 
void LoadData (Context const *logger, RenderTarget *target, uint8_t *values, size_t values_size, PixelFormat data_format)
 
void DestroyTexture (Context const *logger, RenderTarget *target)
 
void DropTexture (Context const *logger, RenderTarget *target)
 
bool allocated () const
 
int2 size () const
 
GLuint texture_id () const
 
ColorSpace gpu_color_space () const
 Color space in shaders = in which colorspace will texels be when fetched in shader. More...
 

Detailed Description

Uses basic self-repairing state control inside create_texture, delete_texture, drop_texture loop. Calling create_texture second time will automatically delete previous texture. Constructors and destructors don't create or delete texture, so this should be done by a wrapper class, otherwise, it's a leak.

RenderTarget should be set to valid value when calling this from draw method.

Definition at line 46 of file GlTexture.hpp.

Constructor & Destructor Documentation

◆ GlTexture()

iv::GlTexture::GlTexture ( )

Definition at line 27 of file GlTexture.cpp.

Member Function Documentation

◆ CreateTexture()

void iv::GlTexture::CreateTexture ( Context const *  logger,
RenderTarget target,
int2  size,
GlMinFiltering  min,
GlMagFiltering  mag,
bool  repeat,
PixelFormat  storage_format,
ColorSpace  color_space 
)

Creates (or recreated) texture in opengl context. Texture is stored using given PixelFormat.

Definition at line 50 of file GlTexture.cpp.

◆ LoadData()

void iv::GlTexture::LoadData ( Context const *  logger,
RenderTarget target,
uint8_t *  values,
size_t  values_size,
PixelFormat  data_format 
)

The data_format can be different than the format used in CreateTexture - data will be transformed, but performance warning will be printed to log.

Definition at line 141 of file GlTexture.cpp.

◆ DestroyTexture()

void iv::GlTexture::DestroyTexture ( Context const *  logger,
RenderTarget target 
)

Definition at line 122 of file GlTexture.cpp.

◆ DropTexture()

void iv::GlTexture::DropTexture ( Context const *  logger,
RenderTarget target 
)

Disassocieates GLuint texture_id from this instance without destroying it.

Definition at line 134 of file GlTexture.cpp.

◆ allocated()

bool iv::GlTexture::allocated ( ) const

Definition at line 45 of file GlTexture.cpp.

◆ size()

int2 iv::GlTexture::size ( ) const

Definition at line 35 of file GlTexture.cpp.

◆ texture_id()

GLuint iv::GlTexture::texture_id ( ) const

Definition at line 40 of file GlTexture.cpp.

◆ gpu_color_space()

ColorSpace iv::GlTexture::gpu_color_space ( ) const

Color space in shaders = in which colorspace will texels be when fetched in shader.

Definition at line 192 of file GlTexture.cpp.


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