class
texture_tstorage class for OpenGL textures
texture_
Constructors, destructors, conversion operators
-
texture_t(texture_
t&& mov) defaulted - move constructor
-
texture_t(const texture_
t& cpy) deleted - copy constructor
-
texture_t(const size_t width,
const size_t height,
image_
format_ t format = image_format_t::rgb_8, const clamp_ mode_ t clamp_mode = clamp_mode_t::repeat, const filter_ mode_ t filter = filter_mode_t::linear, const mipmap_ mode_ t mipmap_mode = mipmap_mode_t::none, swizzle_ mask_ t swizzle_mask = {texture_channel_t::red, texture_channel_t::green, texture_channel_t::blue, texture_channel_t::alpha}) - constuct empty texture with given parameters
-
template<class T>texture_t(const image_
t<T>& image, image_ format_ t format = image_format_t::preferred, const clamp_ mode_ t clamp_mode = clamp_mode_t::repeat, const filter_ mode_ t filter = filter_mode_t::linear, const mipmap_ mode_ t mipmap_mode = mipmap_mode_t::none, swizzle_ mask_ t swizzle_mask = {texture_channel_t::red, texture_channel_t::green, texture_channel_t::blue, texture_channel_t::alpha}) - constuct texture with given parameters from a image_
t object
Public functions
-
auto bind_to_texture_slot() const -> texture_
slot_ t - bind texture to the next free texture unit
- auto height() const -> size_t
- getter function for texture height
-
auto operator=(texture_
t&& mov) -> texture_ t& defaulted - move assignment operator
-
auto operator=(const texture_
t& cpy) -> texture_ t& deleted - copy assignment operator
-
template<class T>void update(const T* pixels, image_
format_ t format = image_format_t::preferred) - update pixel data of the whole texture
-
template<class T>void update(size_t xoffset, size_t yoffset, size_t width, size_t height, const T* pixels, image_
format_ t format = image_format_t::preferred) - update pixel data of rectangular part of the texture
-
template<class T>void update(const image_
t<T>& image) - update pixel data of the whole texture
-
template<class T>void update(const image_
t<T>& image, size_t xoffset, size_t yoffset, size_t width, size_t height) - update pixel data of a part of the texture
- auto width() const -> size_t
- getter function for texture width
Function documentation
glpp:: core:: object:: texture_t:: texture_t(const size_t width,
const size_t height,
image_ format_ t format = image_format_t::rgb_8,
const clamp_ mode_ t clamp_mode = clamp_mode_t::repeat,
const filter_ mode_ t filter = filter_mode_t::linear,
const mipmap_ mode_ t mipmap_mode = mipmap_mode_t::none,
swizzle_ mask_ t swizzle_mask = {texture_channel_t::red, texture_channel_t::green, texture_channel_t::blue, texture_channel_t::alpha})
constuct empty texture with given parameters
Parameters | |
---|---|
width | [in] width of texture in pixels |
height | [in] height of texture in pixels |
format | [in] pixel format representation. format must not be image_format_t::preferred. |
clamp_mode | [in] clamp mode of texture |
filter | [in] filter mode of texture |
mipmap_mode | [in] mipmap mode of texture |
swizzle_mask | [in] swizzle mask of texture |
This constructor will create an OpenGL texture object with the given parameters and allocate memory for the pixel data in the given format. The provided format parameter must not be equal to image_format_t::preferred in this constructor. The swizzle mask can be used to change the color channels in the glsl sampler.
template<class T>
glpp:: core:: object:: texture_t:: texture_t(const image_ t<T>& image,
image_ format_ t format = image_format_t::preferred,
const clamp_ mode_ t clamp_mode = clamp_mode_t::repeat,
const filter_ mode_ t filter = filter_mode_t::linear,
const mipmap_ mode_ t mipmap_mode = mipmap_mode_t::none,
swizzle_ mask_ t swizzle_mask = {texture_channel_t::red, texture_channel_t::green, texture_channel_t::blue, texture_channel_t::alpha})
constuct texture with given parameters from a image_
Parameters | |
---|---|
image | [in] image_ |
format | [in] pixel format representation. If image_format_t::preferred is selected the pixel format of image_ |
clamp_mode | [in] clamp mode of texture |
filter | [in] filter mode of texture |
mipmap_mode | [in] mipmap mode of texture |
swizzle_mask | [in] swizzle mask of texture |
This constructor will create an OpenGL texture object with the given parameters and allocate memory for the pixel data in the given format. The width and height of the texture will match the width and height of the image_
texture_ slot_ t glpp:: core:: object:: texture_t:: bind_to_texture_slot() const
bind texture to the next free texture unit
Returns | texture_ |
---|
This function will bind the texture to the next free texture unit. If there is no more free texture unit to bind to, the function will throw a std::
template<class T>
void glpp:: core:: object:: texture_t:: update(const T* pixels,
image_ format_ t format = image_format_t::preferred)
update pixel data of the whole texture
Parameters | |
---|---|
pixels | [in] new pixel data |
format | [in] format of provided pixel data |
This function will update the pixel data of the texture with the one provided as first argument. The pixel data given will be interpreted with the given pixel format.
template<class T>
void glpp:: core:: object:: texture_t:: update(size_t xoffset,
size_t yoffset,
size_t width,
size_t height,
const T* pixels,
image_ format_ t format = image_format_t::preferred)
update pixel data of rectangular part of the texture
Parameters | |
---|---|
xoffset | [in] offset of the the subtexture from the left |
yoffset | [in] offset of the subtexture from the top |
width | [in] width of the subtexture |
height | [in] height of the subtexture |
pixels | [in] new pixel data |
format | [in] format of provided pixel data |
This function will update the pixel data of the texture with the one provided as argument. The pixel data given will be interpreted with the given pixel format.
template<class T>
void glpp:: core:: object:: texture_t:: update(const image_ t<T>& image,
size_t xoffset,
size_t yoffset,
size_t width,
size_t height)
update pixel data of a part of the texture
Parameters | |
---|---|
image | [in] new pixel data |
xoffset | [in] offset of the the subtexture from the left |
yoffset | [in] offset of the subtexture from the top |
width | [in] width of the subtexture |
height | [in] height of the subtexture |
This function will update the pixel data of the texture with the the pixel data of the provided image_