Represents an OpenGL Texture. Implicitly shared object. More...
#include <DxTexture.h>
Classes | |
struct | Format |
Public Member Functions | |
~Texture () | |
void | setDoNotDispose (bool aDoNotDispose=true) |
Constructs a Texture based on an externally initialized OpenGL texture. aDoNotDispose specifies whether the Texture is responsible for disposing of the associated OpenGL resource. More... | |
void | setWrap (D3D11_TEXTURE_ADDRESS_MODE wrapS, D3D11_TEXTURE_ADDRESS_MODE wrapT) |
Sets the wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are D3D11_TEXTURE_ADDRESS_WRAP , D3D11_TEXTURE_ADDRESS_MIRROR , D3D11_TEXTURE_ADDRESS_CLAMP , D3D11_TEXTURE_ADDRESS_BORDER and D3D11_TEXTURE_ADDRESS_MIRROR_ONCE . More... | |
void | setWrapS (D3D11_TEXTURE_ADDRESS_MODE wrapS) |
Sets the horizontal wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are D3D11_TEXTURE_ADDRESS_WRAP , D3D11_TEXTURE_ADDRESS_MIRROR , D3D11_TEXTURE_ADDRESS_CLAMP , D3D11_TEXTURE_ADDRESS_BORDER and D3D11_TEXTURE_ADDRESS_MIRROR_ONCE . More... | |
void | setWrapT (D3D11_TEXTURE_ADDRESS_MODE wrapT) |
Sets the vertical wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are D3D11_TEXTURE_ADDRESS_WRAP , D3D11_TEXTURE_ADDRESS_MIRROR , D3D11_TEXTURE_ADDRESS_CLAMP , D3D11_TEXTURE_ADDRESS_BORDER and D3D11_TEXTURE_ADDRESS_MIRROR_ONCE . More... | |
void | setFilter (D3D11_FILTER filter) |
Sets the filtering behavior when a texture is displayed at a different resolution than its native resolution. Way too many to list. Look it up on the MSDN. More... | |
void | setCleanTexCoords (float maxU, float maxV) |
void | update (const Surface &surface) |
Replaces the pixels of a texture with contents of surface. Expects surface's size to match the Texture's. More... | |
void | update (const Surface32f &surface) |
Replaces the pixels of a texture with contents of surface. Expects surface's size to match the Texture's. More... | |
void | update (const Surface &surface, const Area &area) |
Replaces the pixels of a texture with contents of surface. Expects area's size to match the Texture's. More... | |
void | update (const Channel &channel) |
Replaces the pixels of a texture with contents of channel. Expects channel's size to match the Texture's. More... | |
void | update (const Channel32f &channel) |
Replaces the pixels of a texture with contents of channel. Expects channel's size to match the Texture's. More... | |
void | update (const Channel8u &channel, const Area &area) |
Replaces the pixels of a texture with contents of channel. Expects area's size to match the Texture's. More... | |
UINT | getWidth () const |
the width of the texture in pixels More... | |
UINT | getHeight () const |
the height of the texture in pixels More... | |
UINT | getCleanWidth () const |
the width of the texture in pixels accounting for its "clean" area - More... | |
UINT | getCleanHeight () const |
the height of the texture in pixels accounting for its "clean" area - More... | |
Vec2i | getSize () const |
the size of the texture in pixels More... | |
float | getAspectRatio () const |
the aspect ratio of the texture (width / height) More... | |
Area | getBounds () const |
the Area defining the Texture's bounds in pixels: [0,0]-[width,height] More... | |
Area | getCleanBounds () const |
the Area defining the Texture's clean pixel bounds in pixels: [0,0]-[width*maxU,height*maxV] More... | |
bool | hasAlpha () const |
whether the texture has an alpha channel More... | |
float | getLeft () const |
These return the right thing even when the texture coordinate space is flipped. More... | |
float | getRight () const |
float | getTop () const |
float | getBottom () const |
float | getMaxU () const |
These do not correspond to "top" and "right" when the texture is flipped. More... | |
float | getMaxV () const |
Rectf | getAreaTexCoords (const Area &area) const |
Returns the UV coordinates which correspond to the pixels contained in area. Does not compensate for clean coordinates. Does compensate for flipping. More... | |
DXGI_FORMAT | getInternalFormat () const |
the Texture's internal format, which is the format that OpenGL stores the texture data in memory. Common values include GL_RGB , GL_RGBA and GL_LUMINANCE More... | |
bool | isFlipped () const |
the target associated with texture. Typical values are GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_ARB More... | |
void | setFlipped (bool aFlipped=true) |
Marks the texture as being flipped vertically or not. More... | |
void | bind (UINT textureUnit=0) const |
Binds the Texture's texture to its target in the multitexturing unit GL_TEXTURE0 + textureUnit. More... | |
void | unbind (UINT textureUnit=0) const |
Unbinds the Texture currently bound in the Texture's target. More... | |
ID3D11Texture2D * | getDxTexture () |
ID3D11ShaderResourceView * | getDxShaderResourceView () |
operator ImageSourceRef () const | |
Returns an ImageSource pointing to this Texture. More... | |
Static Public Member Functions | |
static TextureRef | create (int width, int height, Format format=Format()) |
static TextureRef | create (const unsigned char *data, DXGI_FORMAT dataFormat, int width, int height, Format format=Format()) |
static TextureRef | create (const Surface8u &surface, Format format=Format()) |
static TextureRef | create (const Surface32f &surface, Format format=Format()) |
static TextureRef | create (const Channel8u &channel, Format format=Format()) |
Constructs a Texture based on the contents of channel. More... | |
static TextureRef | create (const Channel32f &channel, Format format=Format()) |
Constructs a Texture based on the contents of channel. More... | |
static TextureRef | create (ImageSourceRef imageSource, Format format=Format()) |
Constructs a texture based on imageSource. More... | |
static TextureRef | loadDds (IStreamRef ddsStream, Format format) |
Creates a new Texture from raw DirectDraw Stream data. More... | |
static void | SurfaceChannelOrderToDataFormatAndType (const SurfaceChannelOrder &sco, DXGI_FORMAT *dataFormat, CinderDxgiChannel *type, bool isSurface32f=false) |
Converts a SurfaceChannelOrder into an appropriate DXGI dataFormat and type. More... | |
static bool | dataFormatHasAlpha (DXGI_FORMAT dataFormat) |
Returns whether a given DXGI dataFormat contains an alpha channel. More... | |
static bool | dataFormatHasColor (DXGI_FORMAT dataFormat) |
Returns whether a give OpenGL dataFormat contains color channels. More... | |
static uint32_t | dataFormatNumChannels (DXGI_FORMAT dataFormat) |
Returns the number of channels for the given DXGI dataFormat. More... | |
Protected Member Functions | |
Texture () | |
Texture (int width, int height, Format format=Format()) | |
Constructs a texture of size(aWidth, aHeight), storing the data in internal format aInternalFormat. More... | |
Texture (const unsigned char *data, DXGI_FORMAT dataFormat, int aWidth, int aHeight, Format format=Format()) | |
Constructs a texture of size(aWidth, aHeight), storing the data in internal format aInternalFormat. Pixel data is provided by data and is expected to be interleaved and in format dataFormat, for which GL_RGB or GL_RGBA would be typical values. More... | |
Texture (const Surface8u &surface, Format format=Format()) | |
Constructs a texture based on the contents of surface. A default value of -1 for internalFormat chooses an appropriate internal format automatically. More... | |
Texture (const Surface32f &surface, Format format=Format()) | |
Constructs a texture based on the contents of surface. A default value of -1 for internalFormat chooses an appropriate internal format automatically. More... | |
Texture (const Channel8u &channel, Format format=Format()) | |
Constructs a texture based on the contents of channel. A default value of -1 for internalFormat chooses an appropriate internal format automatically. More... | |
Texture (const Channel32f &channel, Format format=Format()) | |
Constructs a texture based on the contents of channel. A default value of -1 for internalFormat chooses an appropriate internal format automatically. More... | |
Texture (ImageSourceRef imageSource, Format format=Format()) | |
Constructs a texture based on imageSource. A default value of -1 for internalFormat chooses an appropriate internal format based on the contents of imageSource. More... | |
void | init (int width, int height) |
void | init (const unsigned char *srcData, DXGI_FORMAT srcDataFormat, const Format &format) |
void | init (const float *srcData, DXGI_FORMAT srcDataFormat, const Format &format) |
void | init (ImageSourceRef imageSource, const Format &format) |
Protected Attributes | |
UINT | mWidth |
UINT | mHeight |
UINT | mCleanWidth |
UINT | mCleanHeight |
float | mMaxU |
float | mMaxV |
DXGI_FORMAT | mInternalFormat |
bool | mDoNotDispose |
bool | mFlipped |
ID3D11Texture2D * | mDxTexture |
D3D11_SAMPLER_DESC | mSamplerDesc |
ID3D11SamplerState * | mSamplerState |
ID3D11ShaderResourceView * | mSRV |
Represents an OpenGL Texture. Implicitly shared object.
cinder::dx::Texture::~Texture | ( | ) |
|
protected |
Constructs a texture of size(aWidth, aHeight), storing the data in internal format aInternalFormat.
|
protected |
Constructs a texture of size(aWidth, aHeight), storing the data in internal format aInternalFormat. Pixel data is provided by data and is expected to be interleaved and in format dataFormat, for which GL_RGB
or GL_RGBA
would be typical values.
Constructs a texture based on the contents of surface. A default value of -1 for internalFormat chooses an appropriate internal format automatically.
|
protected |
Constructs a texture based on the contents of surface. A default value of -1 for internalFormat chooses an appropriate internal format automatically.
Constructs a texture based on the contents of channel. A default value of -1 for internalFormat chooses an appropriate internal format automatically.
|
protected |
Constructs a texture based on the contents of channel. A default value of -1 for internalFormat chooses an appropriate internal format automatically.
|
protected |
Constructs a texture based on imageSource. A default value of -1 for internalFormat chooses an appropriate internal format based on the contents of imageSource.
|
static |
Constructs a texture of size(width, height)
|
static |
Constructs a texture of size(width, height). Pixel data is provided by data and is expected to be interleaved and in format dataFormat
|
static |
Constructs a texture based on the contents of surface
|
static |
Constructs a texture based on the contents of surface.
|
static |
Constructs a Texture based on the contents of channel.
|
static |
Constructs a Texture based on the contents of channel.
|
static |
Constructs a texture based on imageSource.
void cinder::dx::Texture::setDoNotDispose | ( | bool | aDoNotDispose = true | ) |
void cinder::dx::Texture::setWrap | ( | D3D11_TEXTURE_ADDRESS_MODE | wrapS, |
D3D11_TEXTURE_ADDRESS_MODE | wrapT | ||
) |
Sets the wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are D3D11_TEXTURE_ADDRESS_WRAP
, D3D11_TEXTURE_ADDRESS_MIRROR
, D3D11_TEXTURE_ADDRESS_CLAMP
, D3D11_TEXTURE_ADDRESS_BORDER
and D3D11_TEXTURE_ADDRESS_MIRROR_ONCE
.
void cinder::dx::Texture::setWrapS | ( | D3D11_TEXTURE_ADDRESS_MODE | wrapS | ) |
Sets the horizontal wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are D3D11_TEXTURE_ADDRESS_WRAP
, D3D11_TEXTURE_ADDRESS_MIRROR
, D3D11_TEXTURE_ADDRESS_CLAMP
, D3D11_TEXTURE_ADDRESS_BORDER
and D3D11_TEXTURE_ADDRESS_MIRROR_ONCE
.
void cinder::dx::Texture::setWrapT | ( | D3D11_TEXTURE_ADDRESS_MODE | wrapT | ) |
Sets the vertical wrapping behavior when a texture coordinate falls outside the range of [0,1]. Possible values are D3D11_TEXTURE_ADDRESS_WRAP
, D3D11_TEXTURE_ADDRESS_MIRROR
, D3D11_TEXTURE_ADDRESS_CLAMP
, D3D11_TEXTURE_ADDRESS_BORDER
and D3D11_TEXTURE_ADDRESS_MIRROR_ONCE
.
void cinder::dx::Texture::setFilter | ( | D3D11_FILTER | filter | ) |
Sets the filtering behavior when a texture is displayed at a different resolution than its native resolution. Way too many to list. Look it up on the MSDN.
void cinder::dx::Texture::setCleanTexCoords | ( | float | maxU, |
float | maxV | ||
) |
Designed to accommodate texture where not all pixels are "clean", meaning the maximum texture coordinate value may not be 1.0 (or the texture's width in GL_TEXTURE_RECTANGLE_ARB
)
Replaces the pixels of a texture with contents of surface. Expects surface's size to match the Texture's.
void cinder::dx::Texture::update | ( | const Surface32f & | surface | ) |
Replaces the pixels of a texture with contents of surface. Expects surface's size to match the Texture's.
Replaces the pixels of a texture with contents of surface. Expects area's size to match the Texture's.
Replaces the pixels of a texture with contents of channel. Expects channel's size to match the Texture's.
void cinder::dx::Texture::update | ( | const Channel32f & | channel | ) |
Replaces the pixels of a texture with contents of channel. Expects channel's size to match the Texture's.
Replaces the pixels of a texture with contents of channel. Expects area's size to match the Texture's.
UINT cinder::dx::Texture::getWidth | ( | ) | const |
the width of the texture in pixels
UINT cinder::dx::Texture::getHeight | ( | ) | const |
the height of the texture in pixels
UINT cinder::dx::Texture::getCleanWidth | ( | ) | const |
the width of the texture in pixels accounting for its "clean" area -
UINT cinder::dx::Texture::getCleanHeight | ( | ) | const |
the height of the texture in pixels accounting for its "clean" area -
Vec2i cinder::dx::Texture::getSize | ( | ) | const |
the size of the texture in pixels
float cinder::dx::Texture::getAspectRatio | ( | ) | const |
the aspect ratio of the texture (width / height)
Area cinder::dx::Texture::getBounds | ( | ) | const |
Area cinder::dx::Texture::getCleanBounds | ( | ) | const |
bool cinder::dx::Texture::hasAlpha | ( | ) | const |
whether the texture has an alpha channel
float cinder::dx::Texture::getLeft | ( | ) | const |
These return the right thing even when the texture coordinate space is flipped.
float cinder::dx::Texture::getRight | ( | ) | const |
float cinder::dx::Texture::getTop | ( | ) | const |
float cinder::dx::Texture::getBottom | ( | ) | const |
float cinder::dx::Texture::getMaxU | ( | ) | const |
These do not correspond to "top" and "right" when the texture is flipped.
float cinder::dx::Texture::getMaxV | ( | ) | const |
Returns the UV coordinates which correspond to the pixels contained in area. Does not compensate for clean coordinates. Does compensate for flipping.
DXGI_FORMAT cinder::dx::Texture::getInternalFormat | ( | ) | const |
the Texture's internal format, which is the format that OpenGL stores the texture data in memory. Common values include GL_RGB
, GL_RGBA
and GL_LUMINANCE
bool cinder::dx::Texture::isFlipped | ( | ) | const |
the target associated with texture. Typical values are GL_TEXTURE_2D
and GL_TEXTURE_RECTANGLE_ARB
whether the texture is flipped vertically
void cinder::dx::Texture::setFlipped | ( | bool | aFlipped = true | ) |
Marks the texture as being flipped vertically or not.
void cinder::dx::Texture::bind | ( | UINT | textureUnit = 0 | ) | const |
Binds the Texture's texture to its target in the multitexturing unit GL_TEXTURE0
+ textureUnit.
void cinder::dx::Texture::unbind | ( | UINT | textureUnit = 0 | ) | const |
|
static |
Creates a new Texture from raw DirectDraw Stream data.
|
static |
Converts a SurfaceChannelOrder into an appropriate DXGI dataFormat and type.
|
static |
Returns whether a given DXGI dataFormat contains an alpha channel.
|
static |
Returns whether a give OpenGL dataFormat contains color channels.
|
static |
Returns the number of channels for the given DXGI dataFormat.
ID3D11Texture2D* cinder::dx::Texture::getDxTexture | ( | ) |
ID3D11ShaderResourceView* cinder::dx::Texture::getDxShaderResourceView | ( | ) |
cinder::dx::Texture::operator ImageSourceRef | ( | ) | const |
Returns an ImageSource pointing to this Texture.
|
protected |
|
protected |
|
protected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
mutableprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |