Unigine::Texture Class
Interface for texture manipulation.
To use this class, include the UnigineTexture.h file.
Unigine::Texture Class
Members
virtual ~Texture ()
Virtual destructor.static Ptr< Texture > create ()
Texture constructor.Return value
Pointer to the created texture.virtual int create (const ImagePtr & image, int flags) const =0
Creates texture from image.Arguments
- const ImagePtr & image - Image pointer.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int create2D (int width, int height, int format, int flags) const =0
Creates 2D texture.Arguments
- int width - Texture width.
- int height - Texture height.
- int format - Texture format.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int create3D (int width, int height, int depth, int format, int flags) const =0
Creates 3D texture.Arguments
- int width - Texture width.
- int height - Texture height.
- int depth - Texture depth.
- int format - Texture format.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int createCube (int width, int height, int format, int flags) const =0
Creates Cube texture.Arguments
- int width - Texture width.
- int height - Texture height.
- int format - Texture format.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int create2DArray (int width, int height, int num_layers, int format, int flags) const =0
Creates 2D Array texture.Arguments
- int width - Texture width.
- int height - Texture height.
- int num_layers - Texture layers.
- int format - Texture format.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int createCubeArray (int width, int height, int num_layers, int format, int flags) const =0
Creates Cube Array texture.Arguments
- int width - Texture width.
- int height - Texture height.
- int num_layers - Texture layers.
- int format - Texture format.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int load (const char * name, int flags) const =0
Loads texture from file.Arguments
- const char * name - File name.
- int flags - Texture flags.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int setImage (const ImagePtr & image) const =0
Sets texture data.Arguments
- const ImagePtr & image - Image pointer.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int getImage (const ImagePtr & image) const =0
Gets texture data.Arguments
- const ImagePtr & image - Image pointer.
Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual void clear () const =0
Clears texture.virtual void destroy () const =0
Destroys texture.virtual int getType () const =0
Gets the texture type.Return value
Texture type.virtual const char * getTypeName () const =0
Gets the texture type name.Return value
Texture type name.virtual int is2DType () const =0
Returns a value indicating if the texture is 2D texture.Return value
Returns 1 if the texture is 2D; otherwise, 0.virtual int is3DType () const =0
Returns a value indicating if the texture is 3D texture.Return value
Returns 1 if the texture is 3D; otherwise, 0.virtual int isCubeType () const =0
Returns a value indicating if the texture is Cube texture.Return value
Returns 1 if the texture is Cube; otherwise, 0.virtual int isArrayType () const =0
Returns a value indicating if the texture is Array texture.Return value
Returns 1 if the texture is Array; otherwise, 0.virtual int getFormat () const =0
Gets the texture format.Return value
Texture format.virtual const char * getFormatName () const =0
Gets the texture format name.Return value
Texture format name.virtual int isRawFormat () const =0
Returns a value indicating if the texture is uncompressed (stored in R8, RG8, RGB8, RGBA8, R16, RG16, RGB16, RGBA16, R16F, RG16F, RGB16F, RGBA16F, R32F, RG32F, RGB32F, RGBA32F, RGB565, RGBA4, RGB5A1, RGB10A2, D16, D24, D24S8, D32F ir D32FS8 format).Return value
Returns 1 if the texture is uncompressed; otherwise, 0.virtual int isUCharFormat () const =0
Returns a value indicating if the texture is stored in an unsigned char format (R8, RG8, RGB8, RGBA8, DXT1, DXT3, DXT5, ATI1 or ATI2).Return value
Returns 1 if the texture is in unsigned char format; otherwise, 0.virtual int isUShortFormat () const =0
Returns a value indicating if the texture is stored in an unsigned short format (R16, RG16, RGB16 or RGBA16).Return value
Returns 1 if the texture is in unsigned short format; otherwise, 0.virtual int isHalfFormat () const =0
Returns a value indicating if the texture is stored in a half-float format (R16F, RG16F, RGB16F or RGBA16F).Return value
Returns 1 if the texture is in half-float format; otherwise, 0.virtual int isFloatFormat () const =0
Returns a value indicating if the texture is stored in a float format (R32F, RG32F, RGB32F or RGBA32F).Return value
Returns 1 if the texture is in float format; otherwise, 0 is returned.virtual int isCombinedFormat () const =0
Returns a value indicating if the texture is stored in a combined format (RGB565, RGBA4, RGB5A1 or RGB10A2).Return value
Returns 1 if the texture is in combined format; otherwise, 0.virtual int isCompressedFormat () const =0
Returns a value indicating if the texture is stored in a compressed format (DXT1, DXT3, DXT5, ATI1, ATI2, ZLC1 or ZLC2).Return value
Returns 1 if the texture is in a compressed format; otherwise, 0.virtual int isColorFormat () const =0
Returns a value indicating if the texture is color texture.Return value
Returns 1 if the texture is color texture; otherwise, 0.virtual int isDepthFormat () const =0
Returns a value indicating if the texture is depth texture.Return value
Returns 1 if the texture is depth texture; otherwise, 0.virtual int getNumChannels () const =0
Returns the number of channels.Return value
Number of channels.virtual int getWidth () const =0
Returns the texture width.Return value
Texture width.virtual int getHeight () const =0
Returns the texture height.Return value
Texture height.virtual int getDepth () const =0
Returns the texture depth.Return value
Texture depth.virtual int getNumMipmaps () const =0
Returns the texture mipmap count.Return value
Texture mipmap count.virtual int getNumLayers () const =0
Returns a number of layers in the texture.Return value
Number of layers.virtual int getNumFaces () const =0
Returns a number of faces in the texture.Return value
Number of faces.virtual void setFlags (int flags) const =0
Sets texture flags.Arguments
- int flags - Texture flags.
virtual int isBilinear () const =0
Checks texture filter.Return value
Returns 1 if the texture filter is bilinear or trilinear.virtual int isAnisotropy () const =0
Checks texture anisotropy.Return value
Returns 1 if the texture filter is anisotropy.virtual int getMultisample () const =0
Returns the multisample count.Return value
Multisample count.virtual int createMipmaps () const =0
Creates mipmaps stack.Return value
Returns 1 if the operation was a success; otherwise, 0 is returned.virtual int copy2D (int x0, int y0, int x1, int y1, int width, int height) const =0
Copies 2D texture.Arguments
- int x0 - The offset of the source texture along the X-axis.
- int y0 - The offset of the source texture along the Y-axis.
- int x1 - The offset of the destination texture along the X-axis.
- int y1 - The offset of the destination texture along the Y-axis.
- int width - The width of the destination texture.
- int height - The height of the destination texture.
Return value
1 if the texture was copied; otherwise, 0.virtual int copyCube (int face, int x0, int y0, int x1, int y1, int width, int height) const =0
Copies Cube texture.Arguments
- int face - The face of the cube.
- int x0 - The offset of the source texture along the X-axis.
- int y0 - The offset of the source texture along the Y-axis.
- int x1 - The offset of the destination texture along the X-axis.
- int y1 - The offset of the destination texture along the Y-axis.
- int width - The width of the destination texture.
- int height - The height of the destination texture.
Return value
1 if the texture was copied; otherwise, 0.virtual void render2D (float x0, float y0, float x1, float y1) const =0
Renders 2D texture. This function creates 4 vertices (2 polygons) by using 2 X-coordinates and 2 Y-coordinates and sends it to be rendered.Arguments
- float x0 - The first X-coordinate.
- float y0 - The first Y-coordinate.
- float x1 - The second X-coordinate.
- float y1 - The second Y-coordinate.
virtual void render2DScreen (float x0, float y0, float x1, float y1) const =0
Renders 2D Screen texture. This function creates 3 vertices (1 polygon) and and sends texture to be rendered inside the polygon to avoid artifacts on the edge of 2 polygons if the anti-aliasing is used.Arguments
- float x0 - The first X-coordinate.
- float y0 - The first Y-coordinate.
- float x1 - The second X-coordinate.
- float y1 - The second Y-coordinate.
virtual void renderCube (int face, float x0, float y0, float x1, float y1) const =0
Renders Cube texture. This function creates 4 vertices (2 polygons) of the given face of the cube texture by using 2 X-coordinates and 2 Y-coordinates and sends it to be rendered.Arguments
- int face - The face of the cube.
- float x0 - The first X-coordinate.
- float y0 - The first Y-coordinate.
- float x1 - The second X-coordinate.
- float y1 - The second Y-coordinate.
virtual void render2DArray (int layer, float x0, float y0, float x1, float y1) const =0
Renders 2D Array texture. This function creates 4 vertices (2 polygons) of the texture layer by using 2 X-coordinates and 2 Y-coordinates and sends it to be rendered.Arguments
- int layer - The number of layer.
- float x0 - The first X-coordinate.
- float y0 - The first Y-coordinate.
- float x1 - The second X-coordinate.
- float y1 - The second Y-coordinate.
virtual void renderCubeArray (int face, int layer, float x0, float y0, float x1, float y1) const =0
Renders Cube Array texture. This function creates 4 vertices (2 polygons) of the given face of the cube texture layer by using 2 X-coordinates and 2 Y-coordinates and sends it to be rendered.Arguments
- int face - The face of the cube.
- int layer - The layer number.
- float x0 - The first X-coordinate.
- float y0 - The first Y-coordinate.
- float x1 - The second X-coordinate.
- float y1 - The second Y-coordinate.
virtual int isRenderFlipped () const =0
Checks the texture orientation.Return value
1 if the texture is flipped.virtual void bindVertex (int unit) const =0
Binds vertex texture.Arguments
- int unit - Texture unit.
virtual void unbindVertex (int unit) const =0
Unbinds vertex texture.Arguments
- int unit - Texture unit.
virtual void bindFragment (int unit) const =0
Binds fragment texture.Arguments
- int unit - Texture unit.
virtual void unbindFragment (int unit) const =0
Unbinds fragment texture.Arguments
- int unit - Texture unit.
virtual void bindCompute (int unit) const =0
Binds compute texture.Arguments
- int unit - Texture unit.
virtual void unbindCompute (int unit) const =0
Unbinds compute texture.Arguments
- int unit - Texture unit.
virtual int getGLTarget () const =0
Returns OpenGL texture target.Return value
OpenGL texture target.virtual int getGLInternalFormat () const =0
Returns OpenGL internal format.Return value
OpenGL internal format.virtual int getGLPixelFormat () const =0
Returns OpenGL pixel format.Return value
OpenGL pixel format.virtual int getGLPixelType () const =0
Returns OpenGL pixel type.Return value
OpenGL pixel type.virtual int getGLTextureID () const =0
Returns OpenGL texture identifier.Return value
OpenGL texture identifier.virtual void * getD3D11Texture () const =0
Returns Direct3D11 texture.virtual void * getD3D11ShaderResourceView () const =0
Returns Direct3D11 render target view.virtual void * getD3D11UnorderedAccessView () const =0
Returns Direct3D11 render target view.virtual void * getD3D11RenderTargetView () const =0
Returns Direct3D11 render target view.virtual void * getD3D11DepthStencilView () const =0
Returns Direct3D11 depth stencil view.virtual void * getD3D11RenderTargetView (int index) const =0
Returns Direct3D11 render target view.Arguments
- int index - Index.
virtual void * getD3D11DepthStencilView (int index) const =0
Returns Direct3D11 depth stencil view.Arguments
- int index - Index.
Unigine::Texture::anonymous_105 Enumeration
TEXTURE_2D
= 0
TEXTURE_3D
TEXTURE_CUBE
TEXTURE_2D_ARRAY
TEXTURE_CUBE_ARRAY
Unigine::Texture::anonymous_106 Enumeration
FORMAT_R8
= 0
FORMAT_RG8
FORMAT_RGB8
FORMAT_RGBA8
FORMAT_R16
FORMAT_RG16
FORMAT_RGB16
FORMAT_RGBA16
FORMAT_R16U
FORMAT_RG16U
FORMAT_RGB16U
FORMAT_RGBA16U
FORMAT_R32U
FORMAT_RG32U
FORMAT_RGB32U
FORMAT_RGBA32U
FORMAT_R16F
FORMAT_RG16F
FORMAT_RGB16F
FORMAT_RGBA16F
FORMAT_R32F
FORMAT_RG32F
FORMAT_RGB32F
FORMAT_RGBA32F
FORMAT_RGB565
FORMAT_RGBA4
FORMAT_RGB5A1
FORMAT_RGB10A2
FORMAT_RG11B10F
FORMAT_DXT1
FORMAT_DXT3
FORMAT_DXT5
FORMAT_ATI1
FORMAT_ATI2
FORMAT_D16
FORMAT_D24
FORMAT_D24S8
FORMAT_D32F
FORMAT_D32FS8
Unigine::Texture::anonymous_107 Enumeration
TYPE_2D_ARRAY
= 1 << 0
TYPE_CUBE_ARRAY
= 1 << 1
FORMAT_SRGB
= 1 << 2
FORMAT_SIGNED
= 1 << 3
FORMAT_INTEGER
= 1 << 4
WRAP_CLAMP
= 1 << 5
WRAP_BORDER
= 1 << 6
FILTER_POINT
= 1 << 7
FILTER_LINEAR
= 1 << 8
FILTER_BILINEAR
= 1 << 9
FILTER_TRILINEAR
= 1 << 10
ANISOTROPY_1
= 1 << 11
ANISOTROPY_2
= 1 << 12
ANISOTROPY_4
= 1 << 13
ANISOTROPY_8
= 1 << 14
ANISOTROPY_16
= 1 << 15
MULTISAMPLE_2
= 1 << 16
MULTISAMPLE_4
= 1 << 17
MULTISAMPLE_8
= 1 << 18
MULTISAMPLE_16
= 1 << 19
USAGE_IMMUTABLE
= 1 << 20
USAGE_DYNAMIC
= 1 << 21
USAGE_STAGING
= 1 << 22
USAGE_RENDER
= 1 << 23
USAGE_COMPUTE
= 1 << 24
DEFAULT_FLAGS
= (FILTER_LINEAR)
Last update: 2017-07-03
Help improve this article
Was this article helpful?
(or select a word/phrase and press Ctrl+Enter)