An OpenGL texture.
More...
#include <OGF/renderer/context/texture.h>
|
void | create_from_data_1d (Memory::pointer ptr, Image::ColorEncoding color_encoding, Image::ComponentEncoding component_encoding, index_t width) |
| Initializes texture data for a 1d texture. More...
|
|
void | create_from_data_2d (Memory::pointer ptr, Image::ColorEncoding color_encoding, Image::ComponentEncoding component_encoding, index_t width, index_t height) |
| Initializes texture data for a 2d texture. More...
|
|
void | create_from_data_3d (Memory::pointer ptr, Image::ColorEncoding color_encoding, Image::ComponentEncoding component_encoding, index_t width, index_t height, index_t depth) |
| Initializes texture data for a 2d texture. More...
|
|
| Counted () |
| Creates a reference counted object. More...
|
|
virtual | ~Counted () |
| Destroys a reference counted object. More...
|
|
An OpenGL texture.
Definition at line 56 of file texture.h.
◆ ~Texture()
OGF::Texture::~Texture |
( |
| ) |
|
Texture destructor.
Deletes the associated OpenGL texture if it was created.
◆ create_from_data()
Creates a texture from raw data.
- Parameters
-
[in] | ptr | a pointer to image data |
[in] | color_encoding | the color encoding of the data |
[in] | component_encoding | the data type used for the color components |
[in] | width | image width |
[in] | height | image height (or 1 for 1d textures) |
[in] | depth | image depth (or 1 for 1d and 2d textures) |
[in] | filtering | the OpenGL filtering mode |
[in] | wrapping | the wrapping mode for texture coordinates |
- Note
- For now, only 2d textures are implemented, and not all datatypes/storage work (under work...)
◆ create_from_data_1d()
Initializes texture data for a 1d texture.
- Parameters
-
[in] | ptr | pointer to texture data |
[in] | color_encoding | the color encoding of the data |
[in] | component_encoding | the data type used for the color components |
[in] | width | the width of the texture |
◆ create_from_data_2d()
Initializes texture data for a 2d texture.
- Parameters
-
[in] | ptr | pointer to texture data |
[in] | color_encoding | the color encoding of the data |
[in] | component_encoding | the data type used for the color components |
[in] | width | the width of the texture |
[in] | height | the height of the texture |
◆ create_from_data_3d()
Initializes texture data for a 2d texture.
- Parameters
-
[in] | ptr | pointer to texture data |
[in] | color_encoding | the color encoding of the data |
[in] | component_encoding | the data type used for the color components |
[in] | width | the width of the texture |
[in] | height | the height of the texture |
[in] | depth | the height of the texture |
◆ create_from_image()
void OGF::Texture::create_from_image |
( |
const Image * |
image, |
|
|
GLint |
filtering = GL_LINEAR , |
|
|
GLint |
wrapping = GL_CLAMP_TO_EDGE |
|
) |
| |
Creates a texture from an image.
- Parameters
-
[in] | image | a const pointer to the Image |
[in] | filtering | the OpenGL filtering mode |
[in] | wrapping | the wrapping mode for texture coordinates |
- Note
- For now, only 2d textures are implemented, and not all datatypes/storage work (under work...)
◆ depth()
index_t OGF::Texture::depth |
( |
| ) |
const |
|
inline |
Gets the height.
- Returns
- the depth of this texture (or 1 for 1d and 2d textures)
Definition at line 100 of file texture.h.
◆ dimension()
index_t OGF::Texture::dimension |
( |
| ) |
const |
Gets the dimension of the texture.
- Return values
-
1 | for a 1d texture |
2 | for a 2d texture |
3 | for a 3d texture |
◆ get_GL_formats()
Gets the parameters for specifying OpenGL textures from Image color encoding and component encoding.
- Parameters
-
[in] | color_encoding | the color encoding of the data |
[in] | component_encoding | the data type used for the color components |
[out] | internal_format | the internal format used by OpenGL texture (parameter of glTexImagenD()) |
[out] | format | the OpenGL format used to pass image data to the OpenGL texture (parameter of glTexImagenD()) |
[out] | type | the type to specify the image components to the OpenGL texture (parameter of glTexImagenD()) |
◆ height()
index_t OGF::Texture::height |
( |
| ) |
const |
|
inline |
Gets the height.
- Returns
- the height of this texture (or 1 for a 1d texture)
Definition at line 92 of file texture.h.
◆ id()
GLuint OGF::Texture::id |
( |
| ) |
const |
|
inline |
Gets the id of the texture.
- Returns
- the OpenGL opaque id of the texture
Definition at line 156 of file texture.h.
◆ reset_id()
void OGF::Texture::reset_id |
( |
| ) |
|
|
inline |
Resets the id of this texture.
If a texture was created, then the association with this Texture is forgotten, and this Texture's destructor no longer destroys the OpenGL texture.
Definition at line 166 of file texture.h.
◆ width()
index_t OGF::Texture::width |
( |
| ) |
const |
|
inline |
Gets the width.
- Returns
- the width of this texture
Definition at line 84 of file texture.h.
The documentation for this class was generated from the following file: