sgltk 0.6
Simple OpenGL Tool Kit
Loading...
Searching...
No Matches
sgltk::Texture_3d Class Reference

Manages 3d textures. More...

#include <texture.h>

Inheritance diagram for sgltk::Texture_3d:
Collaboration diagram for sgltk::Texture_3d:

Public Member Functions

 Texture_3d (const std::vector< std::string > &paths)
 Texture_3d (const std::vector< sgltk::Image > &images)
 Texture_3d (unsigned int res_x, unsigned int res_y, unsigned int res_z, GLenum internal_format, GLenum type, GLenum format)
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.
bool load (const std::vector< sgltk::Image > &images)
 Load a new image as texture.
bool load (const std::vector< std::string > &paths)
 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.
Public Member Functions inherited from sgltk::Texture
void set_parameter (GLenum name, int parameter)
 Sets a texture parameter.
void set_parameter (GLenum name, float parameter)
 Sets a texture parameter.
void set_parameter (GLenum name, float *parameter)
 Sets a texture parameter.
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.

Additional Inherited Members

Static Public Member Functions inherited from sgltk::Texture
static void add_path (std::string path)
 Adds a path to the list of paths to be searched for image files.
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)
static std::shared_ptr< Texturefind_texture (std::string name)
 Finds a texture in the internal map using the name as key.
Public Attributes inherited from sgltk::Texture
GLenum target
 The texture target.
GLuint texture
 The texture name.
unsigned int width
 The width of the texture.
unsigned int height
 The height of the texture.
unsigned int num_layers
 The number of layers.

Detailed Description

Manages 3d textures.

Definition at line 374 of file texture.h.

Constructor & Destructor Documentation

◆ Texture_3d() [1/4]

Texture_3d::Texture_3d ( )

Definition at line 5 of file texture_3d.cpp.

◆ Texture_3d() [2/4]

Texture_3d::Texture_3d ( const std::vector< std::string > & paths)
Parameters
pathsPath to the image file to load

Definition at line 25 of file texture_3d.cpp.

◆ Texture_3d() [3/4]

sgltk::Texture_3d::Texture_3d ( const std::vector< sgltk::Image > & images)
Parameters
imagesThe image to use as the texture

◆ Texture_3d() [4/4]

Texture_3d::Texture_3d ( unsigned int res_x,
unsigned int res_y,
unsigned int res_z,
GLenum internal_format,
GLenum type,
GLenum format )
Parameters
res_xThe texture x resolution
res_yThe texture y resolution
res_zThe texture z resolution
internal_formatThe internal format of the texture
typeThe type of pixel data
formatThe format of the textre

Definition at line 9 of file texture_3d.cpp.

◆ ~Texture_3d()

Texture_3d::~Texture_3d ( )

Definition at line 30 of file texture_3d.cpp.

Member Function Documentation

◆ bind()

void Texture_3d::bind ( unsigned int texture_unit = 0)
virtual

Bind the texture to be used by the shader.

Parameters
texture_unitThe texture unit to bind the texture to

Implements sgltk::Texture.

Definition at line 113 of file texture_3d.cpp.

◆ create_empty()

void Texture_3d::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.

Parameters
res_xThe texture x resolution
res_yThe texture y resolution
res_zThe texture z resolution
internal_formatThe internal format of the texture
typeThe type of pixel data
formatThe format of the textre

Definition at line 33 of file texture_3d.cpp.

◆ load() [1/2]

bool sgltk::Texture_3d::load ( const std::vector< sgltk::Image > & images)

Load a new image as texture.

Parameters
imagesThe image to use as the texture

◆ load() [2/2]

bool Texture_3d::load ( const std::vector< std::string > & paths)

Load a new image as texture.

Parameters
pathsThe path to the image file

Definition at line 55 of file texture_3d.cpp.

◆ unbind()

void Texture_3d::unbind ( unsigned int texture_unit = 0)
virtual

Unbind the texture.

Parameters
texture_unitThe texture unit to bind the texture to

Implements sgltk::Texture.

Definition at line 118 of file texture_3d.cpp.


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