Easy3D 2.5.3
Texture Class Reference

OpenGL texture. More...

#include <easy3d/renderer/texture.h>

Public Types

enum  WrapMode { CLAMP_TO_EDGE , REPEAT }
 
enum  FilterMode { NEAREST , LINEAR }
 

Public Member Functions

unsigned int id () const
 
const std::string & name () const
 
void bind (int unit=0) const
 
void release () const
 
int width () const
 
int height () const
 
int channels () const
 
WrapMode wrap_mode () const
 
FilterMode filter_mode () const
 

Static Public Member Functions

static Texturecreate (const std::string &image_file, WrapMode wrap=CLAMP_TO_EDGE, FilterMode filter=LINEAR)
 
static Texturecreate (const std::vector< unsigned char > &rgb_data, int width, int height, int comp, WrapMode wrap=CLAMP_TO_EDGE, FilterMode filter=LINEAR)
 

Friends

class TextureManager
 

Detailed Description

OpenGL texture.

currently only TEXTURE_2D is supported

Examples
Tutorial_207_RealCamera, Tutorial_303_ScalarField, Tutorial_305_Texture, and Tutorial_306_Image.

Member Function Documentation

◆ create() [1/2]

Texture * create ( const std::string &  image_file,
WrapMode  wrap = CLAMP_TO_EDGE,
FilterMode  filter = LINEAR 
)
static

Creates a texture from an image file. @image_file The full path to the image file.

Returns
The created texture.

◆ create() [2/2]

Texture * create ( const std::vector< unsigned char > &  rgb_data,
int  width,
int  height,
int  comp,
WrapMode  wrap = CLAMP_TO_EDGE,
FilterMode  filter = LINEAR 
)
static

Creates a texture from the given image data.

Parameters
rgb_dataThe image data.
widthThe width (i.e., number of columns) of the image.
heightThe rows (i.e., number of rows) of the image.
compThe number of components for each pixel (e.g., 3 for RGB)
Returns
The created texture.

The documentation for this class was generated from the following files: