Cinder  0.8.6
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Pages
DxTexture.h
Go to the documentation of this file.
1 // The copyright in this software is being made available under the BSD License, included below.
2 // This software may be subject to other third party and contributor rights, including patent rights,
3 // and no such rights are granted under this license.
4 //
5 // Copyright (c) 2013, Microsoft Open Technologies, Inc.
6 // All rights reserved.
7 //
8 // Redistribution and use in source and binary forms, with or without modification,
9 // are permitted provided that the following conditions are met:
10 //
11 // - Redistributions of source code must retain the above copyright notice,
12 // this list of conditions and the following disclaimer.
13 // - Redistributions in binary form must reproduce the above copyright notice,
14 // this list of conditions and the following disclaimer in the documentation
15 // and/or other materials provided with the distribution.
16 // - Neither the name of Microsoft Open Technologies, Inc. nor the names of its contributors
17 // may be used to endorse or promote products derived from this software
18 // without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS “AS IS” AND ANY EXPRESS OR IMPLIED WARRANTIES,
21 // INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
22 // FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
23 // INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24 // PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
25 // HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
26 // OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
27 // EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 
29 
30 #pragma once
31 
32 #include "cinder/Cinder.h"
33 #include "cinder/dx/dx.h"
34 #include "cinder/Surface.h"
35 #include "cinder/Rect.h"
36 #include "cinder/Stream.h"
37 #include "cinder/FileSystem.h"
38 
39 #include <vector>
40 #include <utility>
41 
42 #include <d3d11.h>
43 
44 namespace cinder { namespace dx {
45 
51 };
52 
53 
54 class Texture;
55 typedef std::shared_ptr<Texture> TextureRef;
56 
59 class Texture {
60  public:
61  struct Format;
62 
64  static TextureRef create( int width, int height, Format format = Format() ) { return TextureRef( new Texture( width, height, format ) ); }
66  static TextureRef create( const unsigned char *data, DXGI_FORMAT dataFormat, int width, int height, Format format = Format() ) { return TextureRef( new Texture( data, dataFormat, width, height, format ) ); }
68  static TextureRef create( const Surface8u &surface, Format format = Format() ) { return TextureRef( new Texture( surface, format ) ); }
70  static TextureRef create( const Surface32f &surface, Format format = Format() ) { return TextureRef( new Texture( surface, format ) ); }
72  static TextureRef create( const Channel8u &channel, Format format = Format() ) { return TextureRef( new Texture( channel, format ) ); }
74  static TextureRef create( const Channel32f &channel, Format format = Format() ) { return TextureRef( new Texture( channel, format ) ); }
76  static TextureRef create( ImageSourceRef imageSource, Format format = Format() ) { return TextureRef( new Texture( imageSource, format ) ); }
77 
78  ~Texture();
79 
80 #if defined( CINDER_WINRT )
81 
84  static void loadImageAsync(const fs::path path, dx::Texture &texture, const Format format = Format());
85 #endif
86 
88  //Texture( GLenum aTarget, GLuint aTextureID, int aWidth, int aHeight, bool aDoNotDispose );
89 
91  void setDoNotDispose( bool aDoNotDispose = true ) { mDoNotDispose = aDoNotDispose; }
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 );
102  void setFilter( D3D11_FILTER filter );
103 
105  void setCleanTexCoords( float maxU, float maxV );
106 
108  void update( const Surface &surface );
110  void update( const Surface32f &surface );
113  void update( const Surface &surface, const Area &area );
115  void update( const Channel &channel );
117  void update( const Channel32f &channel );
119  void update( const Channel8u &channel, const Area &area );
120 
122  UINT getWidth() const;
124  UINT getHeight() const;
126  UINT getCleanWidth() const;
128  UINT getCleanHeight() const;
130  Vec2i getSize() const { return Vec2i( getWidth(), getHeight() ); }
132  float getAspectRatio() const { return getWidth() / (float)getHeight(); }
134  Area getBounds() const { return Area( 0, 0, getWidth(), getHeight() ); }
136  Area getCleanBounds() const { return Area( 0, 0, getCleanWidth(), getCleanHeight() ); }
138  bool hasAlpha() const;
140  float getLeft() const;
141  float getRight() const;
142  float getTop() const;
143  float getBottom() const;
145  float getMaxU() const;
146  float getMaxV() const;
148  Rectf getAreaTexCoords( const Area &area ) const;
150  DXGI_FORMAT getInternalFormat() const;
152  //GLenum getTarget() const { return mTarget; }
154  bool isFlipped() const { return mFlipped; }
156  void setFlipped( bool aFlipped = true ) { mFlipped = aFlipped; }
157 
159  void bind( UINT textureUnit = 0 ) const;
161  void unbind( UINT textureUnit = 0 ) const;
162 
164  static TextureRef loadDds( IStreamRef ddsStream, Format format );
165 
167  //static void SurfaceChannelOrderToDataFormatAndType( const SurfaceChannelOrder &sco, GLint *dataFormat, GLenum *type );
168  static void SurfaceChannelOrderToDataFormatAndType( const SurfaceChannelOrder &sco, DXGI_FORMAT *dataFormat, CinderDxgiChannel* type, bool isSurface32f = false );
169 
171  //static bool dataFormatHasAlpha( GLint dataFormat );
172  static bool dataFormatHasAlpha( DXGI_FORMAT dataFormat );
174  //static bool dataFormatHasColor( GLint dataFormat );
175  static bool dataFormatHasColor( DXGI_FORMAT dataFormat );
177  static uint32_t dataFormatNumChannels( DXGI_FORMAT dataFormat );
178 
179  ID3D11Texture2D* getDxTexture() { return mDxTexture; }
180  ID3D11ShaderResourceView* getDxShaderResourceView() { return mSRV; }
181 
182 #if ! defined( CINDER_GLES )
183  operator ImageSourceRef() const;
185 #endif
186 
187  struct Format {
189  Format();
190 
192  //void setTarget( GLenum target ) { mTarget = target; }
194 #ifndef CINDER_GLES
195  //void setTargetRect() { mTarget = GL_TEXTURE_RECTANGLE_ARB; }
196 #endif
197 
200 
204  void setAutoInternalFormat() { mInternalFormat = (DXGI_FORMAT)-1; }
205 
207  void setWrap( D3D11_TEXTURE_ADDRESS_MODE wrapS, D3D11_TEXTURE_ADDRESS_MODE wrapT ) { setWrapS( wrapS ); setWrapT( wrapT ); }
210  void setWrapS( D3D11_TEXTURE_ADDRESS_MODE wrapS ) { mWrapS = wrapS; }
213  void setWrapT( D3D11_TEXTURE_ADDRESS_MODE wrapT ) { mWrapT = wrapT; }
216  void setFilter( D3D11_FILTER filter ) { mFilter = filter; }
217 
219  //GLenum getTarget() const { return mTarget; }
221  bool hasMipmapping() const { return mMipmapping; }
222 
224  DXGI_FORMAT getInternalFormat() const { return mInternalFormat; }
226  bool isAutoInternalFormat() const { return mInternalFormat == -1; }
227 
229  D3D11_TEXTURE_ADDRESS_MODE getWrapS() const { return mWrapS; }
231  D3D11_TEXTURE_ADDRESS_MODE getWrapT() const { return mWrapT; }
233  D3D11_FILTER getFilter() const { return mFilter; }
234 
236  bool isRenderTarget() const { return mRenderTarget; }
238  void enableRenderTarget( bool bEnableRenderTarget = true ) { mRenderTarget = bEnableRenderTarget; }
239 
240  protected:
241  //GLenum mTarget;
242  D3D11_TEXTURE_ADDRESS_MODE mWrapS, mWrapT;
243  D3D11_FILTER mFilter;
245  DXGI_FORMAT mInternalFormat;
247 
248  friend class Texture;
249  };
250 
251  protected:
252  Texture();
254  Texture( int width, int height, Format format = Format() );
256  Texture( const unsigned char *data, DXGI_FORMAT dataFormat, int aWidth, int aHeight, Format format = Format() );
258  Texture( const Surface8u &surface, Format format = Format() );
260  Texture( const Surface32f &surface, Format format = Format() );
262  Texture( const Channel8u &channel, Format format = Format() );
264  Texture( const Channel32f &channel, Format format = Format() );
266  Texture( ImageSourceRef imageSource, Format format = Format() );
267 
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 );
271  void init( ImageSourceRef imageSource, const Format &format );
272 
273 /* Obj() : mWidth( -1 ), mHeight( -1 ), mCleanWidth( -1 ), mCleanHeight( -1 ), mInternalFormat( (DXGI_FORMAT)-1 ), mFlipped( false ), mDeallocatorFunc( 0 ), mDxTexture(NULL), mSamplerState(NULL), mSRV(NULL)
274  {}
275  Obj( int aWidth, int aHeight ) : mInternalFormat( (DXGI_FORMAT)-1 ), mWidth( aWidth ), mHeight( aHeight ), mCleanWidth( aWidth ), mCleanHeight( aHeight ), mFlipped( false ), mDeallocatorFunc( 0 ), mDxTexture(NULL), mSamplerState(NULL), mSRV(NULL)
276  {}
277  ~Obj();*/
278 
279  mutable UINT mWidth, mHeight;
280  mutable UINT mCleanWidth, mCleanHeight;
281  float mMaxU, mMaxV;
282  DXGI_FORMAT mInternalFormat;
283 
285  bool mFlipped;
286 
287  ID3D11Texture2D *mDxTexture;
288  D3D11_SAMPLER_DESC mSamplerDesc;
289  ID3D11SamplerState *mSamplerState;
290  ID3D11ShaderResourceView *mSRV;
291 };
292 
293 /*
294 class TextureCache {
295  public:
296  TextureCache() {}
297  TextureCache( const Surface8u &prototypeSurface, const Texture::Format &format );
298 
299  dx::Texture cache( const Surface8u &data );
300 
301  protected:
302  struct Obj {
303  Obj( const Surface8u &prototypeSurface, const Texture::Format &format );
304 
305  void markTextureAsFree( int id );
306 
307  int mWidth, mHeight;
308  Texture::Format mFormat;
309 
310  int mNextId;
311  std::vector<std::pair<int,dx::Texture> > mTextures;
312 
313  static void TextureCacheDeallocator( void *aDeallocatorRefcon );
314  };
315 
316  std::shared_ptr<Obj> mObj;
317 
318  public:
320  typedef std::shared_ptr<Obj> TextureCache::*unspecified_bool_type;
322  operator unspecified_bool_type() const { return ( mObj.get() == 0 ) ? 0 : &TextureCache::mObj; }
323  void reset() { mObj.reset(); }
325 };
326 */
327 
329  public:
331  virtual int32_t getRowBytes( int requestedWidth, const SurfaceChannelOrder &sco, int elementSize ) const { return requestedWidth * elementSize * sco.getPixelInc(); }
332 };
333 
334 class TextureDataExc : public std::exception {
335 public:
336  TextureDataExc( const std::string &log ) throw();
337  virtual const char* what() const throw()
338  {
339  return mMessage;
340  }
341 
342 private:
343  char mMessage[16001];
344  GLint mShaderType;
345 };
346 
347 
348 } } // namespace cinder::gl
Definition: Surface.h:64
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
Definition: Surface.h:64
Definition: Area.h:37
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
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
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
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