sculpto
gl_texture.h
Go to the documentation of this file.
1/*!****************************************************************//*!*
2 * \file gl_texture.h
3 * \brief OpenGL texture class definition module.
4 *
5 * \author Sabitov Kirill
6 * \date 28 June 2022
7 *********************************************************************/
8
9#pragma once
10
11#include "gl.h"
13
14namespace scl
15{
18 {
19 private:
20 mutable u32 Slot {};
21 GLuint Id {};
22
23 public:
25 render_primitive::handle GetHandle() const override { return Id; }
26
27 private:
28 /*!*
29 * Create OpenGL color texture from image container function.
30 *
31 * \param Image - image container to create texture from.
32 * \param IsFloatingPoint - flag, showing wheather texture use range [0; 1] or higher.
33 * \return None.
34 */
35 void CreateColor(const image &Image, bool IsFloatingPoint);
36
37 /*!*
38 * Create OpenGL depth texture function.
39 *
40 * \param None.
41 * \return None.
42 */
43 void CreateDepth(const image &Image);
44
45 public:
46 /*!*
47 * OpenGL texture constructor by image container.
48 *
49 * \param Image - image container to get data from (pixels data can be null).
50 * \param Type - texture type.
51 * \return created texture pointer.
52 */
53 gl_texture_2d(const image &Image, texture_type Type);
54
56 ~gl_texture_2d() override;
57
58 /*!*
59 * Bind texture to current render stage function.
60 *
61 * \param None.
62 * \return None.
63 */
64 void Bind(u32 Slot) const override;
65
66 /*!*
67 * Unbind texture from current render stage function.
68 *
69 * \param None.
70 * \return None.
71 */
72 void Unbind() const override;
73
74 /*!*
75 * Unload texture from GPU memory function.
76 *
77 * \param None.
78 * \return None.
79 */
80 void Free() override;
81
82 /*!*
83 * Load texture image from GPU memory function.
84 *
85 * \param None.
86 * \return texture image.
87 */
88 image GetImage() override;
89 };
90}
image GetImage() override
Definition: gl_texture.cpp:99
void Unbind() const override
Definition: gl_texture.cpp:85
gl_texture_2d(const image &Image, texture_type Type)
Definition: gl_texture.cpp:56
render_primitive::handle GetHandle() const override
Definition: gl_texture.h:25
~gl_texture_2d() override
Definition: gl_texture.cpp:71
void Bind(u32 Slot) const override
Definition: gl_texture.cpp:76
void Free() override
Definition: gl_texture.cpp:91
Definition: base.h:33
uint32_t u32
Definition: math_common.h:21
texture_type
Definition: texture.h:18
Texture interface definition module.