Texture
Inherited: None
Description
This class can be used to handle texture resource or create them at runtime.
Public Methods
void |
addSurface (const Texture::Surface & surface) |
int |
depthBits () const |
int |
filtering () const |
int |
format () const |
int |
getPixel (int x, int y, int level) const |
ByteArray |
getPixels (int level) const |
int |
height () const |
bool |
isArray () const |
bool |
isCompressed () const |
bool |
isCubemap () const |
bool |
isFeedback () const |
bool |
isRender () const |
int |
mipCount () const |
void |
readPixels (int x, int y, int width, int height) |
void |
resize (int width, int height) |
void |
setDepthBits (int depth) |
void |
setDirty () |
void |
setFiltering (int type) |
void |
setFlags (int flags) |
void |
setFormat (int type) |
void |
setHeight (int height) |
void |
setWidth (int width) |
void |
setWrap (int type) |
int |
sides () const |
Texture::Surface & |
surface (int side) |
int |
width () const |
int |
wrap () const |
Public Enums
enum Texture::FilteringType
Constant |
Value |
Description |
Texture::None |
0 |
Texture samples draw as is. |
Texture::Bilinear |
1 |
Texture samples are averaged. |
Texture::Trilinear |
2 |
Texture samples are averaged and also interpolated from adjacent mipmap levels. |
enum Texture::Flags
Constant |
Value |
Description |
Texture::Render |
(1<<0) |
This texture is used as render target in frame buffers. |
Texture::Feedback |
(1<<1) |
The feedback textures can read data from GPU to CPU. |
enum Texture::FormatType
Constant |
Value |
Description |
Texture::R8 |
0 |
Single channel(Red) texture. 8-bit integer |
Texture::RGB8 |
1 |
Color texture format. 8 bit integer per channel. 24-bits in total. |
Texture::RGBA8 |
2 |
Color texture format with alpha channel. 8-bit integer per channel. 32-bits in total. |
Texture::RGB10A2 |
3 |
10 bits each for RGB, 2 for Alpha. |
Texture::RGBA32Float |
6 |
Color texture and alpha with floating-point values. It uses 32-bit floating-point values per channel. |
Texture::R11G11B10Float |
4 |
This uses special 11 and 10-bit floating-point values. This is very economical for floating-point values (using only 32-bits per value). |
Texture::Depth |
5 |
Depth buffer texture format. Number bits per pixel depend on graphical settings and hardware. Can be 16, 24 or 32-bit per pixel. |
enum Texture::WrapType
Wrap mode for textures.
Constant |
Value |
Description |
Texture::Clamp |
0 |
Clamps the texture to the last pixel at the edge. |
Texture::Repeat |
1 |
Tiles the texture, creating a repeating pattern. |
Texture::Mirrored |
2 |
Tiles the texture, creating a repeating pattern by mirroring it at every integer boundary. |
Static Methods
uint32_t |
|
uint32_t |
Methods Description
void Texture::addSurface (Texture::Surface & surface)
Adds surface to the texture. Each texture must contain at least one surface.
int Texture::depthBits () const
Returns the number of depth bits.
Note: This value is valid only for the depth textures.
See also setDepthBits().
int Texture::filtering () const
Returns filtering type of texture. For more details please see the Texture::FilteringType enum.
See also setFiltering().
int Texture::format () const
Returns format type of texture. For more details please see the Texture::FormatType enum.
See also setFormat().
int Texture::getPixel (int x, int y, int level) const
Returns pixel color from mip level at x and y position as RGBA integer for example 0x00ff00ff which can be mapped to (0, 255, 0, 255)
ByteArray Texture::getPixels (int level) const
Returns texture data from a mip level.
int Texture::height () const
Returns height for the texture.
See also setHeight().
bool Texture::isArray () const
Returns true if texture provides a set of textures; otherwise returns false.
Note: For now will always return false.
bool Texture::isCompressed () const
Returns true if texture uses one of the compression formats; otherwise returns false.
bool Texture::isCubemap () const
Returns true if the texture is a cube map; otherwise returns false.
bool Texture::isFeedback () const
Returns true if texture marked as a feed back texture; otherwise returns false. The feedback textures can read data from GPU to CPU.
bool Texture::isRender () const
Returns true if texture is can be attached to framebuffer; otherwise returns false.
uint32_t Texture::maxCubemapSize ()
Returns the maximum cubemap size.
uint32_t Texture::maxTextureSize ()
Returns the maximum texure size.
int Texture::mipCount () const
Returns the number of MIP levels.
void Texture::readPixels (int x, int y, int width, int height)
Read pixels from GPU at x and y position with width and height dimensions into texture data.
void Texture::resize (int width, int height)
Sets new width and height for the texture.
void Texture::setDepthBits (int depth)
Sets the number of depth bits.
Note: This value is valid only for the depth textures.
See also *depth*Bits().
void Texture::setDirty ()
Marks texture as dirty. That means this texture must be forcefully reloaded.
void Texture::setFiltering (int type)
Sets filtering type of texture. For more details please see the Texture::FilteringType enum.
See also filtering().
void Texture::setFlags (int flags)
Sets service flags for the texture.
See also Texture::Flags.
void Texture::setFormat (int type)
Sets format type of texture. For more details please see the Texture::FormatType enum.
See also format().
void Texture::setHeight (int height)
Sets new height for the texture.
See also *height*().
void Texture::setWidth (int width)
Sets new width for the texture.
See also *width*().
void Texture::setWrap (int type)
Sets the type of warp policy. For more details please see the Texture::WrapType enum.
See also wrap().
int Texture::sides () const
Returns the number of texture sides. In most cases returns 1 but for the cube map will return 6
Texture::Surface & Texture::surface (int side)
Returns a surface for the provided side. Each texture must contain at least one surface. Commonly used to set surfaces for the cube maps.
int Texture::width () const
Returns width for the texture.
See also setWidth().
int Texture::wrap () const
Returns the type of warp policy. For more details please see the Texture::WrapType enum.
See also setWrap().