emilib
Public Member Functions | Protected Member Functions | List of all members
gl::Texture Class Reference

#include <gl_lib.hpp>

Public Member Functions

 Texture ()
 Will create an invalid texture!
 
 Texture (GLuint id, Size size, TexParams params_arg, ImageFormat format, std::string debug_name)
 
 Texture (std::string debug_name, TexParams params={}, ImageFormat format={}, Size size={0, 0}, const void *data=nullptr)
 
 Texture (const Texture &)=delete
 
Textureoperator= (const Texture &)=delete
 
 Texture (Texture &&other)
 
void operator= (Texture &&other)
 
void swap (Texture &other)
 
void free ()
 Free allocated texture, if any. sets id = 0.ß
 
void set_data (const void *data, Size size, ImageFormat format)
 
void set_data (const void *data)
 Note: data MUST be in the correct format.
 
void set_mip_data (const void *data, Size size, unsigned level)
 
const ImageFormatformat () const
 
const TexParamsparams () const
 
void set_params (const TexParams &params)
 
bool has_data () const
 
bool is_power_of_two () const
 
const std::string & debug_name () const
 
void set_debug_name (const std::string &debug_name)
 
void bind (unsigned tu=0) const
 We must have an id.
 
unsigned width () const
 
unsigned height () const
 
const Sizesize () const
 
void set_bits_per_pixel (unsigned bpp)
 Use to override when you know the format is compressed.
 
unsigned bits_per_pixel () const
 
size_t memory_usage () const
 in bytes
 
GLuint id () const
 0 if not generated
 
bool has_id () const
 
void generate_mipmaps ()
 

Protected Member Functions

void init (const void *data)
 
void set_wrap_mode (WrapMode s, WrapMode t) const
 
void set_filtering (TexFilter filter) const
 

Detailed Description

A texture can be in three states: No id, no data id, no data, id and data.


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