OpenGL texture.
More...
#include <easy3d/renderer/texture.h>
|
| ~Texture () |
| Destructor.
|
|
unsigned int | id () const |
| Get the OpenGL texture ID.
|
|
const std::string & | name () const |
| Get the name of the texture.
|
|
void | bind (int unit=0) const |
| Bind the texture to a texture unit.
|
|
void | release () const |
| Release the texture.
|
|
int | width () const |
| Get the width of the texture.
|
|
int | height () const |
| Get the height of the texture.
|
|
int | channels () const |
| Get the number of channels of the texture.
|
|
WrapMode | wrap_mode () const |
| Get the wrap mode of the texture.
|
|
FilterMode | filter_mode () const |
| Get the filter mode of the texture.
|
|
OpenGL texture.
currently only TEXTURE_2D is supported
- Examples
- Tutorial_305_Texture/main.cpp, and Tutorial_306_ImageViewer/main.cpp.
◆ FilterMode
The filter mode of the texture.
Enumerator |
---|
NEAREST | Nearest neighbor interpolation.
|
LINEAR | Linear interpolation.
|
◆ WrapMode
The wrap mode of the texture.
Enumerator |
---|
CLAMP_TO_EDGE | Clamp the texture coordinate to the range [0, 1].
|
REPEAT | Repeat the texture coordinate.
|
◆ bind()
void bind |
( |
int | unit = 0 | ) |
const |
Bind the texture to a texture unit.
- Parameters
-
unit | The texture unit to bind to. |
◆ channels()
Get the number of channels of the texture.
- Returns
- The number of channels of the texture.
◆ create() [1/2]
Creates a texture from an image file.
- Parameters
-
image_file | The full path to the image file. |
wrap | The wrap mode of the texture. |
filter | The filter mode of the texture. |
- Returns
- The created texture.
◆ create() [2/2]
Creates a texture from the given image data.
- Parameters
-
rgb_data | The image data. |
width | The width (i.e., number of columns) of the image. |
height | The height (i.e., number of rows) of the image. |
comp | The number of components for each pixel (e.g., 3 for RGB). |
wrap | The wrap mode of the texture. |
filter | The filter mode of the texture. |
- Returns
- The created texture.
◆ filter_mode()
Get the filter mode of the texture.
- Returns
- The filter mode of the texture.
◆ height()
◆ id()
unsigned int id |
( |
| ) |
const |
|
inline |
Get the OpenGL texture ID.
- Returns
- The texture ID.
◆ name()
const std::string & name |
( |
| ) |
const |
|
inline |
Get the name of the texture.
- Returns
- The name of the texture.
◆ width()
◆ wrap_mode()
Get the wrap mode of the texture.
- Returns
- The wrap mode of the texture.
The documentation for this class was generated from the following files:
- G:/3_code/Easy3D/easy3d/renderer/texture.h
- G:/3_code/Easy3D/easy3d/renderer/texture.cpp