AvogadroLibs 1.98.1
|
The Texture2D class manages texture resources in graphics libraries.
#include <avogadro/rendering/texture2d.h>
Public Types | |
enum | FilterOption { InvalidFilter = -1 , Nearest = 0 , Linear } |
The FilterOption enum defines options for interpolating texels onto pixels. More... | |
enum | WrappingOption { InvalidWrapping = -1 , ClampToEdge = 0 , MirroredRepeat , Repeat } |
The WrappingOption enum defines options for handling texture coordinates outside of the range [0, 1]. Note that these are specified separately for each dimension of the texture. More... | |
enum | InternalFormat { InvalidInternalFormat = -1 , InternalDepth = 0 , InternalDepthStencil , InternalR , InternalRG , InternalRGB , InternalRGBA } |
The InternalFormat enum defines how the texture data will be stored by the graphics library implementation. More... | |
enum | IncomingFormat { InvalidIncomingFormat = -1 , IncomingR = 0 , IncomingRG , IncomingRGB , IncomingBGR , IncomingRGBA , IncomingBGRA , IncomingDepth , IncomingDepthStencil } |
The IncomingFormat enum defines the supported formats for incoming texture data. More... | |
Public Member Functions | |
Index | handle () const |
bool | ready () const |
void | setMinFilter (FilterOption opt) |
FilterOption | minFilter () const |
void | setMagFilter (FilterOption opt) |
FilterOption | magFilter () const |
template<class ContainerT > | |
bool | upload (const ContainerT &buffer, const Vector2i &dims, IncomingFormat dataFormat, InternalFormat internalFormat) |
bool | bind () const |
bool | release () const |
std::string | error () const |
void | setWrappingS (WrappingOption opt) |
WrappingOption | wrappingS () const |
void | setWrappingT (WrappingOption opt) |
WrappingOption | wrappingT () const |
enum FilterOption |
enum WrappingOption |
enum InternalFormat |
enum IncomingFormat |
Index handle | ( | ) | const |
A unique integer value identifying the texture.
bool ready | ( | ) | const |
True if the texture is ready to use.
void setMinFilter | ( | FilterOption | opt | ) |
Filtering options for interpolating pixel values. Default is Linear. {@
void setWrappingS | ( | WrappingOption | opt | ) |
Wrapping options in the s-direction. Default is Repeat.
WrappingOption wrappingS | ( | ) | const |
Wrapping options in the s-direction. Default is Repeat.
void setWrappingT | ( | WrappingOption | opt | ) |
Wrapping options in the t-direction. Default is Repeat.
WrappingOption wrappingT | ( | ) | const |
Wrapping options in the t-direction. Default is Repeat.
bool upload | ( | const ContainerT & | buffer, |
const Vector2i & | dims, | ||
IncomingFormat | dataFormat, | ||
InternalFormat | internalFormat | ||
) |
Upload a buffer of texture data to the graphics library.
buffer | The texture data (see below for requirements of ContainerT). |
dims | The width and height of the texture data. |
dataFormat | The ordering of components in the buffer data. |
internalFormat | The internal storage ordering of components in the buffer data. |
The buffer must contain homogeneous elements of the follow types: unsigned char, char, unsigned short, short, unsigned int, int, or float.
The first element of buffer is the lower-left texel. Subsequent elements are ordered such that rows are contiguous, moving right and up.
The ContainerT must satisfy the following requirements (short version: use std::vector or Avogadro::Core::Array):
bool bind | ( | ) | const |
Bind the texture for rendering.