44 namespace cinder {
namespace dx {
80 #if defined( CINDER_WINRT )
84 static void loadImageAsync(
const fs::path path, dx::Texture &
texture,
const Format
format = Format());
93 void setWrap( D3D11_TEXTURE_ADDRESS_MODE wrapS, D3D11_TEXTURE_ADDRESS_MODE wrapT ) {
setWrapS( wrapS );
setWrapT( wrapT ); }
96 void setWrapS( D3D11_TEXTURE_ADDRESS_MODE wrapS );
99 void setWrapT( D3D11_TEXTURE_ADDRESS_MODE wrapT );
159 void bind( UINT textureUnit = 0 )
const;
161 void unbind( UINT textureUnit = 0 )
const;
182 #if ! defined( CINDER_GLES )
268 void init(
int width,
int height );
269 void init(
const unsigned char *srcData, DXGI_FORMAT srcDataFormat,
const Format &
format );
270 void init(
const float *srcData, DXGI_FORMAT srcDataFormat,
const Format &
format );
290 ID3D11ShaderResourceView *
mSRV;
337 virtual const char*
what()
const throw()
343 char mMessage[16001];
void setDoNotDispose(bool aDoNotDispose=true)
Constructs a Texture based on an externally initialized OpenGL texture. aDoNotDispose specifies wheth...
Definition: DxTexture.h:91
UINT getCleanHeight() const
the height of the texture in pixels accounting for its "clean" area -
Definition: DxTexture.cpp:1085
Base class for defining the properties of a Surface necessary to be interoperable with different APIs...
Definition: Surface.h:76
float getLeft() const
These return the right thing even when the texture coordinate space is flipped.
Definition: DxTexture.cpp:1036
void setCleanTexCoords(float maxU, float maxV)
Definition: DxTexture.cpp:1005
bool hasAlpha() const
whether the texture has an alpha channel
Definition: DxTexture.cpp:1020
D3D11_TEXTURE_ADDRESS_MODE mWrapT
Definition: DxTexture.h:242
float getRight() const
Definition: DxTexture.cpp:1041
Vec2i getSize() const
the size of the texture in pixels
Definition: DxTexture.h:130
void setInternalFormat(DXGI_FORMAT internalFormat)
Sets the Texture's internal format. A value of -1 implies selecting the best format for the context...
Definition: DxTexture.h:202
DXGI_FORMAT getInternalFormat() const
the Texture's internal format, which is the format that OpenGL stores the texture data in memory...
Definition: DxTexture.cpp:1051
float mMaxV
Definition: DxTexture.h:281
static TextureRef create(const Surface32f &surface, Format format=Format())
Definition: DxTexture.h:70
bool mRenderTarget
Definition: DxTexture.h:246
static TextureRef create(ImageSourceRef imageSource, Format format=Format())
Constructs a texture based on imageSource.
Definition: DxTexture.h:76
float getBottom() const
Definition: DxTexture.cpp:1115
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.
Definition: DxTexture.h:93
D3D11_TEXTURE_ADDRESS_MODE getWrapS() const
Returns the horizontal wrapping behavior for the texture coordinates.
Definition: DxTexture.h:229
GLenum GLenum GLuint texture
Definition: GLee.h:5383
float mMaxU
Definition: DxTexture.h:281
GLsizei const GLchar ** string
Definition: GLee.h:2427
void update(const Surface &surface)
Replaces the pixels of a texture with contents of surface. Expects surface's size to match the Textur...
Definition: DxTexture.cpp:675
static TextureRef create(int width, int height, Format format=Format())
Definition: DxTexture.h:64
Area getCleanBounds() const
the Area defining the Texture's clean pixel bounds in pixels: [0,0]-[width*maxU,height*maxV] ...
Definition: DxTexture.h:136
ID3D11SamplerState * mSamplerState
Definition: DxTexture.h:289
D3D11_TEXTURE_ADDRESS_MODE getWrapT() const
Returns the vertical wrapping behavior for the texture coordinates.
Definition: DxTexture.h:231
GLenum internalFormat
Definition: GLee.h:7149
bool isFlipped() const
the target associated with texture. Typical values are GL_TEXTURE_2D and GL_TEXTURE_RECTANGLE_ARB ...
Definition: DxTexture.h:154
GLenum GLsizei width
Definition: GLee.h:969
static void SurfaceChannelOrderToDataFormatAndType(const SurfaceChannelOrder &sco, DXGI_FORMAT *dataFormat, CinderDxgiChannel *type, bool isSurface32f=false)
Converts a SurfaceChannelOrder into an appropriate DXGI dataFormat and type.
Definition: DxTexture.cpp:838
Definition: DxTexture.h:48
Definition: DxTexture.h:47
virtual int32_t getRowBytes(int requestedWidth, const SurfaceChannelOrder &sco, int elementSize) const
Definition: DxTexture.h:331
void setWrapT(D3D11_TEXTURE_ADDRESS_MODE wrapT)
Sets the vertical wrapping behavior when a texture coordinate falls outside the range of [0...
Definition: DxTexture.cpp:991
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:1011
std::shared_ptr< Texture > TextureRef
Definition: dx.h:61
UINT getHeight() const
the height of the texture in pixels
Definition: DxTexture.cpp:1067
CinderDxgiChannel
Definition: DxTexture.h:46
bool mFlipped
Definition: DxTexture.h:285
bool hasMipmapping() const
Returns the texture's target.
Definition: DxTexture.h:221
UINT mCleanHeight
Definition: DxTexture.h:280
float getAspectRatio() const
the aspect ratio of the texture (width / height)
Definition: DxTexture.h:132
Definition: DxTexture.h:328
void setFilter(D3D11_FILTER filter)
Sets the filtering behavior when a texture is displayed at a lower resolution than its native resolut...
Definition: DxTexture.h:216
Specifies the in-memory ordering of the channels of a Surface.
Definition: Surface.h:42
void setFlipped(bool aFlipped=true)
Marks the texture as being flipped vertically or not.
Definition: DxTexture.h:156
void init(int width, int height)
Definition: DxTexture.cpp:300
std::shared_ptr< IStreamCinder > IStreamRef
Definition: Stream.h:142
void setWrapS(D3D11_TEXTURE_ADDRESS_MODE wrapS)
Sets the horizontal wrapping behavior when a texture coordinate falls outside the range of [0...
Definition: DxTexture.cpp:984
Texture()
Definition: DxTexture.cpp:115
TextureDataExc(const std::string &log)
Definition: DxTexture.cpp:56
void setWrapT(D3D11_TEXTURE_ADDRESS_MODE wrapT)
Sets the vertical wrapping behavior when a texture coordinate falls outside the range of [0...
Definition: DxTexture.h:213
void bind(UINT textureUnit=0) const
Binds the Texture's texture to its target in the multitexturing unit GL_TEXTURE0 + textureUnit...
Definition: DxTexture.cpp:1130
UINT mHeight
Definition: DxTexture.h:279
bool mMipmapping
Definition: DxTexture.h:244
Definition: DxTexture.h:334
GLenum GLsizei GLsizei height
Definition: GLee.h:1029
D3D11_FILTER mFilter
Definition: DxTexture.h:243
GLclampf GLclampf GLclampf alpha
Definition: GLee.h:951
DXGI_FORMAT mInternalFormat
Definition: DxTexture.h:245
bool isRenderTarget() const
Returns true if render target flag is set.
Definition: DxTexture.h:236
Definition: DxTexture.h:50
UINT getWidth() const
the width of the texture in pixels
Definition: DxTexture.cpp:1059
Rectf getAreaTexCoords(const Area &area) const
Returns the UV coordinates which correspond to the pixels contained in area. Does not compensate for ...
Definition: DxTexture.cpp:1094
static TextureRef loadDds(IStreamRef ddsStream, Format format)
Creates a new Texture from raw DirectDraw Stream data.
Definition: DxTexture.cpp:967
ID3D11ShaderResourceView * mSRV
Definition: DxTexture.h:290
Definition: DxTexture.h:49
Represents an OpenGL Texture. Implicitly shared object.
Definition: DxTexture.h:59
static bool dataFormatHasColor(DXGI_FORMAT dataFormat)
Returns whether a give OpenGL dataFormat contains color channels.
Definition: DxTexture.cpp:919
D3D11_TEXTURE_ADDRESS_MODE mWrapS
Definition: DxTexture.h:242
UINT getCleanWidth() const
the width of the texture in pixels accounting for its "clean" area -
Definition: DxTexture.cpp:1075
static uint32_t dataFormatNumChannels(DXGI_FORMAT dataFormat)
Returns the number of channels for the given DXGI dataFormat.
Definition: DxTexture.cpp:933
static TextureRef create(const Channel32f &channel, Format format=Format())
Constructs a Texture based on the contents of channel.
Definition: DxTexture.h:74
void enableMipmapping(bool enableMipmapping=true)
Specifies the texture's target. The default is GL_TEXTURE_2D.
Definition: DxTexture.h:199
uint8_t getPixelInc() const
Definition: Surface.h:55
virtual const char * what() const
Definition: DxTexture.h:337
GLuint GLuint GLsizei GLenum type
Definition: GLee.h:963
UINT mWidth
Definition: DxTexture.h:279
~Texture()
Definition: DxTexture.cpp:97
int int channel
Definition: GLee.h:17150
D3D11_FILTER getFilter() const
Returns the texture minifying function, which is used whenever the pixel being textured maps to an ar...
Definition: DxTexture.h:233
bool isAutoInternalFormat() const
Returns whether the Texture's internal format will be automatically selected based on the context...
Definition: DxTexture.h:226
void setAutoInternalFormat()
Sets the Texture's internal format to be automatically selected based on the context.
Definition: DxTexture.h:204
float getMaxV() const
Definition: DxTexture.cpp:1125
ID3D11Texture2D * getDxTexture()
Definition: DxTexture.h:179
int int int * dx
Definition: GLee.h:17162
virtual SurfaceChannelOrder getChannelOrder(bool alpha) const
Definition: DxTexture.h:330
D3D11_SAMPLER_DESC mSamplerDesc
Definition: DxTexture.h:288
Area getBounds() const
the Area defining the Texture's bounds in pixels: [0,0]-[width,height]
Definition: DxTexture.h:134
void setWrapS(D3D11_TEXTURE_ADDRESS_MODE wrapS)
Sets the horizontal wrapping behavior when a texture coordinate falls outside the range of [0...
Definition: DxTexture.h:210
Definition: DxTexture.h:187
GLint GLint GLint GLint GLint GLint GLint GLbitfield GLenum filter
Definition: GLee.h:5419
int GLint
Definition: gldx.h:51
GLenum GLsizei GLenum format
Definition: GLee.h:969
UINT mCleanWidth
Definition: DxTexture.h:280
ID3D11ShaderResourceView * getDxShaderResourceView()
Definition: DxTexture.h:180
void enableRenderTarget(bool bEnableRenderTarget=true)
Enables or disables render target. Default is disabled.
Definition: DxTexture.h:238
std::shared_ptr< class ImageSource > ImageSourceRef
Definition: Channel.h:33
static bool dataFormatHasAlpha(DXGI_FORMAT dataFormat)
Returns whether a given DXGI dataFormat contains an alpha channel.
Definition: DxTexture.cpp:895
void unbind(UINT textureUnit=0) const
Unbinds the Texture currently bound in the Texture's target.
Definition: DxTexture.cpp:1136
DXGI_FORMAT getInternalFormat() const
Returns the Texture's internal format. A value of -1 implies automatic selection of the internal form...
Definition: DxTexture.h:224
float getMaxU() const
These do not correspond to "top" and "right" when the texture is flipped.
Definition: DxTexture.cpp:1120
bool mDoNotDispose
Definition: DxTexture.h:284
ID3D11Texture2D * mDxTexture
Definition: DxTexture.h:287
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 GL_CLAMP, GL_REPEAT and GL_CLAMP_TO_EDGE. The default is GL_CLAMP.
Definition: DxTexture.h:207
float getTop() const
Definition: DxTexture.cpp:1046
DXGI_FORMAT mInternalFormat
Definition: DxTexture.h:282
void setFilter(D3D11_FILTER filter)
Sets the filtering behavior when a texture is displayed at a different resolution than its native res...
Definition: DxTexture.cpp:998
Format()
Default constructor, sets the target to GL_TEXTURE_2D, wrap to GL_CLAMP, disables mipmapping...
Definition: DxTexture.cpp:84
static TextureRef create(const unsigned char *data, DXGI_FORMAT dataFormat, int width, int height, Format format=Format())
Definition: DxTexture.h:66
static TextureRef create(const Channel8u &channel, Format format=Format())
Constructs a Texture based on the contents of channel.
Definition: DxTexture.h:72
Vec2< int > Vec2i
Definition: Vector.h:1313
static TextureRef create(const Surface8u &surface, Format format=Format())
Definition: DxTexture.h:68