17 EXPORT
static std::map<std::string, std::shared_ptr<Texture> > textures;
26 EXPORT
static void add_path(std::string path);
84 EXPORT
static std::shared_ptr<Texture>
find_texture(std::string name);
89 virtual void bind(
unsigned int texture_unit = 0) = 0;
94 virtual void unbind(
unsigned int texture_unit = 0) = 0;
108 EXPORT
void bind_image(GLuint unit, GLint level,
109 GLboolean layered, GLint layer,
110 GLenum access, GLenum format);
118class Texture_1d :
public Texture {
124 EXPORT Texture_1d(
const std::string& path);
135 EXPORT Texture_1d(
unsigned int res,
136 GLenum internal_format,
137 GLenum type, GLenum format);
138 EXPORT ~Texture_1d();
148 GLenum internal_format,
160 EXPORT
bool load(
const std::string& path);
165 EXPORT
void bind(
unsigned int texture_unit = 0);
170 EXPORT
void unbind(
unsigned int texture_unit = 0);
178class Texture_1d_Array :
public Texture {
180 EXPORT Texture_1d_Array();
184 EXPORT Texture_1d_Array(
const std::vector<std::string>& paths);
197 EXPORT Texture_1d_Array(
unsigned int res,
199 GLenum internal_format,
200 GLenum type, GLenum format);
201 EXPORT ~Texture_1d_Array();
213 GLenum internal_format,
220 EXPORT
bool load(
const std::vector<sgltk::Image>& images);
225 EXPORT
bool load(
const std::vector<std::string>& paths);
230 EXPORT
void bind(
unsigned int texture_unit = 0);
235 EXPORT
void unbind(
unsigned int texture_unit = 0);
243class Texture_2d :
public Texture {
249 EXPORT Texture_2d(
const std::string& path);
261 EXPORT Texture_2d(
unsigned int res_x,
263 GLenum internal_format,
264 GLenum type, GLenum format);
265 EXPORT ~Texture_2d();
277 GLenum internal_format,
289 EXPORT
bool load(
const std::string& path);
294 EXPORT
void bind(
unsigned int texture_unit = 0);
299 EXPORT
void unbind(
unsigned int texture_unit = 0);
306class Texture_2d_Array :
public Texture {
308 EXPORT Texture_2d_Array();
312 EXPORT Texture_2d_Array(
const std::vector<std::string>& paths);
326 EXPORT Texture_2d_Array(
unsigned int res_x,
329 GLenum internal_format,
330 GLenum type, GLenum format);
331 EXPORT ~Texture_2d_Array();
345 GLenum internal_format,
352 EXPORT
bool load(
const std::vector<sgltk::Image>& images);
357 EXPORT
bool load(
const std::vector<std::string>& paths);
362 EXPORT
void bind(
unsigned int texture_unit = 0);
367 EXPORT
void unbind(
unsigned int texture_unit = 0);
374class Texture_3d :
public Texture {
380 EXPORT Texture_3d(
const std::vector<std::string>& paths);
393 EXPORT Texture_3d(
unsigned int res_x,
396 GLenum internal_format,
399 EXPORT ~Texture_3d();
413 GLenum internal_format,
420 EXPORT
bool load(
const std::vector<sgltk::Image>& images);
425 EXPORT
bool load(
const std::vector<std::string>& paths);
430 EXPORT
void bind(
unsigned int texture_unit = 0);
435 EXPORT
void unbind(
unsigned int texture_unit = 0);
442class Cubemap :
public Texture {
452 EXPORT Cubemap(
unsigned int res_x,
454 GLenum internal_format,
481 GLenum internal_format,
493 EXPORT
bool load(
const std::string& pos_x,
const std::string& neg_x,
494 const std::string& pos_y,
const std::string& neg_y,
495 const std::string& pos_z,
const std::string& neg_z);
512 EXPORT
void bind(
unsigned int texture_unit = 0);
517 EXPORT
void unbind(
unsigned int texture_unit = 0);
void unbind(unsigned int texture_unit=0)
Unbind the texture.
void create_empty(unsigned int res_x, unsigned int res_y, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
bool load(const std::string &pos_x, const std::string &neg_x, const std::string &pos_y, const std::string &neg_y, const std::string &pos_z, const std::string &neg_z)
Load a new cubemap.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
void unbind(unsigned int texture_unit=0)
Unbind the texture.
void create_empty(unsigned int res, unsigned int num_layers, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
Texture_1d_Array(const std::vector< sgltk::Image > &images)
bool load(const std::vector< sgltk::Image > &images)
Load a new image as texture.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
bool load(const sgltk::Image &image)
Load a new image as texture.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
void unbind(unsigned int texture_unit=0)
Unbind the texture.
void create_empty(unsigned int res, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
bool load(const std::vector< sgltk::Image > &images)
Load a new image as texture.
void unbind(unsigned int texture_unit=0)
Unbind the texture.
Texture_2d_Array(const std::vector< sgltk::Image > &images)
void create_empty(unsigned int res_x, unsigned int res_y, unsigned int num_layers, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
void unbind(unsigned int texture_unit=0)
Unbind the texture.
void create_empty(unsigned int res_x, unsigned int res_y, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
bool load(const sgltk::Image &image)
Load a new image as texture.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
Texture_3d(const std::vector< sgltk::Image > &images)
void create_empty(unsigned int res_x, unsigned int res_y, unsigned int res_z, GLenum internal_format, GLenum type, GLenum format)
Creates an empty texture.
void unbind(unsigned int texture_unit=0)
Unbind the texture.
bool load(const std::vector< sgltk::Image > &images)
Load a new image as texture.
void bind(unsigned int texture_unit=0)
Bind the texture to be used by the shader.
unsigned int num_layers
The number of layers.
static std::shared_ptr< Texture > find_texture(std::string name)
Finds a texture in the internal map using the name as key.
void bind_image(GLuint unit, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format)
Binds a level of a texture to an image unit.
unsigned int width
The width of the texture.
static bool store_texture(std::string name, std::shared_ptr< Texture > texture)
Stores a texture object in an internal map using the name parameter as key (no duplicates)
GLenum target
The texture target.
void set_parameter(GLenum name, int parameter)
Sets a texture parameter.
virtual void unbind(unsigned int texture_unit=0)=0
Unbind the texture.
virtual void bind(unsigned int texture_unit=0)=0
Bind the texture to be used by the shader.
GLuint texture
The texture name.
static void add_path(std::string path)
Adds a path to the list of paths to be searched for image files.
unsigned int height
The height of the texture.