hx3d  1
2D/3D Simple Game Framework
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | List of all members
hx3d::graphics::Texture Class Reference

2D/3D texture management. More...

#include <texture.hpp>

Public Types

Public Member Functions

 Texture ()
 Construct an empty texture. See load to build the texture.
 
 Texture (std::string pathToImage)
 Construct a texture from an image path. More...
 
 Texture (Image &image)
 Construct a texture from an memory image. More...
 
bool load (std::string pathToImage)
 Build the texture from an image. More...
 
void setFilter (FilterType type, FilterValue value)
 Set the texture filters. More...
 
void updateZone (unsigned int x, unsigned int y, unsigned int w, unsigned int h, Uint8 *data)
 Update a zone in the texture. More...
 
unsigned int getWidth ()
 Get the texture width. More...
 
unsigned int getHeight ()
 Get the texture height. More...
 
GLuint getID ()
 Get the texture ID. More...
 

Static Public Member Functions

static Ptr< TexturecreateColorBuffer (unsigned int width, unsigned int height)
 Create a color buffer (used in framebuffers). More...
 
static void use (Ptr< Texture > texture)
 Use the current texture for drawing. More...
 
static void use (Ptr< Font > font, int characterSize)
 Use the current font atlas for drawing. More...
 
static void disable ()
 Clear the current texture for drawing.
 
static void generateBlankTexture ()
 Used to create the Texture::Blank texture.
 

Static Public Attributes

static Ptr< TextureBlank
 Default blank texture.
 

Detailed Description

2D/3D texture management.

Definition at line 39 of file texture.hpp.

Member Enumeration Documentation

Filtering type.

Enumerator
Min 

Min. filter.

Max 

Max. filter.

WrapX 

S wrapping filter.

WrapY 

T wrapping filter.

Definition at line 45 of file texture.hpp.

Filtering value.

Enumerator
Linear 

Linear filter.

Nearest 

Nearest filter.

LinearMipmapLinear 

Linear Mipmap Linear.

NearestMipmapLinear 

Nearest Mipmap Linear.

LinearMipmapNearest 

Linear Mipmap Nearest.

NearestMipmapNearest 

Nearest Mipmap Nearest.

ClampToEdge 

Clamp texture to edges.

MirroredRepeat 

Repeat mirrored.

Repeat 

Repeat.

Definition at line 61 of file texture.hpp.

Constructor & Destructor Documentation

hx3d::graphics::Texture::Texture ( std::string  pathToImage)

Construct a texture from an image path.

Parameters
pathToImagePath to image

Definition at line 37 of file texture.cpp.

hx3d::graphics::Texture::Texture ( Image image)

Construct a texture from an memory image.

Parameters
imageImage

Definition at line 41 of file texture.cpp.

Member Function Documentation

Ptr< Texture > hx3d::graphics::Texture::createColorBuffer ( unsigned int  width,
unsigned int  height 
)
static

Create a color buffer (used in framebuffers).

Parameters
widthTexture width
heightTexture height
Returns
Texture (Ptr)

Definition at line 140 of file texture.cpp.

unsigned int hx3d::graphics::Texture::getHeight ( )

Get the texture height.

Returns
Height

Definition at line 169 of file texture.cpp.

GLuint hx3d::graphics::Texture::getID ( )

Get the texture ID.

Returns
Texture ID

Definition at line 161 of file texture.cpp.

unsigned int hx3d::graphics::Texture::getWidth ( )

Get the texture width.

Returns
Width

Definition at line 165 of file texture.cpp.

bool hx3d::graphics::Texture::load ( std::string  pathToImage)

Build the texture from an image.

Parameters
pathToImagePath to image
Returns
OK/Error

Definition at line 72 of file texture.cpp.

void hx3d::graphics::Texture::setFilter ( FilterType  type,
FilterValue  value 
)

Set the texture filters.

Parameters
typeFilter type
valueFilter value

Definition at line 98 of file texture.cpp.

void hx3d::graphics::Texture::updateZone ( unsigned int  x,
unsigned int  y,
unsigned int  w,
unsigned int  h,
Uint8 *  data 
)

Update a zone in the texture.

Parameters
xX coordinate
yY coordinate
wWidth
hHeight
dataData

Definition at line 173 of file texture.cpp.

void hx3d::graphics::Texture::use ( Ptr< Texture texture)
static

Use the current texture for drawing.

Parameters
textureTexture (Ptr)

Definition at line 127 of file texture.cpp.

void hx3d::graphics::Texture::use ( Ptr< Font font,
int  characterSize 
)
static

Use the current font atlas for drawing.

Parameters
fontFont (Ptr)
characterSizeCharacter size

Definition at line 131 of file texture.cpp.


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