glpp::core::object::texture_slot_t class

helper class representing a binding of a texture object to a texture unit

This class is a RAII wrapper for the binding of textures to texture units. It can be created with the conversion constructior or calling texture_t::bind_to_texture_slot(). Upon destruction the binding will be released and the texture unit can be reused. The texture_slot_t class will keep track of the bound texture units. Changeing the global state with plain OpenGL calls may lead to conflicts.

Constructors, destructors, conversion operators

texture_slot_t(const texture_t& texture)
default constructor
texture_slot_t(texture_slot_t&& mov)
move constructor
texture_slot_t(const texture_slot_t& cpy) deleted
copy constructor

Public functions

auto id() const -> GLint
get id of corresponding texture unit
auto operator=(texture_slot_t&& mov) -> texture_slot_t&
move assignment operaotr
auto operator=(const texture_slot_t& cpy) -> texture_slot_t& deleted
copy assignment operaotr

Function documentation

glpp::core::object::texture_slot_t::texture_slot_t(const texture_t& texture)

default constructor

conversion constructor

The default constructor will not bind a texture to a texture unit, but reserves a texture unit for manual usage. The id of this texture_slot can be used for manual initialisation.

This constructor will bind the texture to a texture unit and create a texture_slot_t object representing this binding. The texture may be destroyed while beeing bound, but reading from a slot after this will yield undefined results.

glpp::core::object::texture_slot_t::texture_slot_t(texture_slot_t&& mov)

move constructor

texutre_slot_t is move constructible.

glpp::core::object::texture_slot_t::texture_slot_t(const texture_slot_t& cpy) deleted

copy constructor

texutre_slot_t is not copy constructible.

GLint glpp::core::object::texture_slot_t::id() const

get id of corresponding texture unit

Returns texture unit id that is used

texture_slot_t& glpp::core::object::texture_slot_t::operator=(texture_slot_t&& mov)

move assignment operaotr

texutre_slot_t is move assignable.

texture_slot_t& glpp::core::object::texture_slot_t::operator=(const texture_slot_t& cpy) deleted

copy assignment operaotr

texutre_slot_t is not copy assignable.