This page has been translated automatically.
Programming
Fundamentials
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Bounds-Related Classes
Containers
Controls-Related Classes
Core Library
Engine-Related Classes
GUI-Related Classes
Node-Related Classes
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Utility Classes
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Texture Class

Interface for texture manipulation.

To use this class, include the UnigineTexture.h file.

Texture Class

Members


int copy2D (int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, int w = -1, int h = -1)

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 w - The width of the destination texture.
  • int h - The height of the destination texture.

Return value

1 if the texture was copied; otherwise, 0.

int isFloatFormat ()

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.

int getWidth ()

Returns the texture width.

Return value

Texture width.

void render2D (float x0 = -1.0f, float y0 = -1.0f, float x1 = 1.0f, float y1 = 1.0f)

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.

int isCubeType ()

Returns a value indicating if the texture is Cube texture.

Return value

Returns 1 if the texture is Cube; otherwise, 0.

void renderCubeArray (int face, int layer, float x0 = -1.0f, float y0 = -1.0f, float x1 = 1.0f, float y1 = 1.0f)

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.

int getType ()

Gets the texture type.

Return value

Texture type.

int load (const char * name, int flags = DEFAULT_FLAGS)

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.

void * getD3D11DepthStencilView ()

Returns Direct3D11 depth stencil view.

Return value

int getMultisample ()

Returns the multisample count.

Return value

Multisample count.

int fromGLTexture2D (unsigned int tex_id, int width, int height, int format, int flags)

Arguments

  • unsigned int tex_id
  • int width
  • int height
  • int format
  • int flags

Return value

void * getD3D11Texture ()

Returns Direct3D11 texture.

Return value

void bindVertex (int unit)

Binds vertex texture.

Arguments

  • int unit - Texture unit.

int getNumFaces ()

Returns a number of faces in the texture.

Return value

Number of faces.

int is3DType ()

Returns a value indicating if the texture is 3D texture.

Return value

Returns 1 if the texture is 3D; otherwise, 0.

int isBilinear ()

Checks texture filter.

Return value

Returns 1 if the texture filter is bilinear or trilinear.

void render2DArray (int layer, float x0 = -1.0f, float y0 = -1.0f, float x1 = 1.0f, float y1 = 1.0f)

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.

Ptr<Texture> create ()

Texture constructor.

Return value

Pointer to the created texture.

void * getD3D11RenderTargetView (int index)

Returns Direct3D11 render target view.

Arguments

  • int index - Index.

Return value

void * getD3D11ShaderResourceView ()

Returns Direct3D11 render target view.

Return value

int getNumMipmaps ()

Returns the texture mipmap count.

Return value

Texture mipmap count.

int createCubeArray (int width, int height, int num_layers, int format, int flags = DEFAULT_FLAGS)

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.

int getGLPixelType ()

Returns OpenGL pixel type.

Return value

OpenGL pixel type.

void render2DScreen (float x0 = -1.0f, float y0 = -1.0f, float x1 = 1.0f, float y1 = 1.0f)

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.

int create2D (int width, int height, int format, int flags = DEFAULT_FLAGS)

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.

int create (const Ptr<Image> & image, int flags = DEFAULT_FLAGS)

Texture constructor.

Arguments

  • const Ptr<Image> & image - Image pointer.
  • int flags - Texture flags.

Return value

Pointer to the created texture.

int isCombinedFormat ()

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.

void bindFragment (int unit)

Binds fragment texture.

Arguments

  • int unit - Texture unit.

int isArrayType ()

Returns a value indicating if the texture is Array texture.

Return value

Returns 1 if the texture is Array; otherwise, 0.

int getHeight ()

Returns the texture height.

Return value

Texture height.

int is2DType ()

Returns a value indicating if the texture is 2D texture.

Return value

Returns 1 if the texture is 2D; otherwise, 0.

void * getD3D11DepthStencilView (int index)

Returns Direct3D11 depth stencil view.

Arguments

  • int index - Index.

Return value

int isColorFormat ()

Returns a value indicating if the texture is color texture.

Return value

Returns 1 if the texture is color texture; otherwise, 0.

void * getD3D11UnorderedAccessView ()

Returns Direct3D11 render target view.

Return value

int create2DArray (int width, int height, int num_layers, int format, int flags = DEFAULT_FLAGS)

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.

int getImage (const Ptr<Image> & image)

Gets texture data.

Arguments

  • const Ptr<Image> & image - Image pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void clear ()

Clears texture.

int getGLPixelFormat ()

Returns OpenGL pixel format.

Return value

OpenGL pixel format.

void unbindCompute (int unit)

Unbinds compute texture.

Arguments

  • int unit - Texture unit.

const char * getTypeName ()

Gets the texture type name.

Return value

Texture type name.

int createCube (int width, int height, int format, int flags = DEFAULT_FLAGS)

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.

int copyCube (int face, int x0 = 0, int y0 = 0, int x1 = 0, int y1 = 0, int w = -1, int h = -1)

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 w - The width of the destination texture.
  • int h - The height of the destination texture.

Return value

1 if the texture was copied; otherwise, 0.

int isUShortFormat ()

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.

int getNumChannels ()

Returns the number of channels.

Return value

Number of channels.

int create3D (int width, int height, int depth, int format, int flags = DEFAULT_FLAGS)

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.

void setFlags (int flags)

Sets texture flags.

Arguments

  • int flags - Texture flags.

void unbindVertex (int unit)

Unbinds vertex texture.

Arguments

  • int unit - Texture unit.

int isHalfFormat ()

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.

int isAnisotropy ()

Checks texture anisotropy.

Return value

Returns 1 if the texture filter is anisotropy.

int fromGLTexture2D (unsigned int tex_id, int width, int height, int format, int internal_format, int flags)

Arguments

  • unsigned int tex_id
  • int width
  • int height
  • int format
  • int internal_format
  • int flags

Return value

void renderCube (int face, float x0 = -1.0f, float y0 = -1.0f, float x1 = 1.0f, float y1 = 1.0f)

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.

int isCompressedFormat ()

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.

int getGLTarget ()

Returns OpenGL texture target.

Return value

OpenGL texture target.

int isDepthFormat ()

Returns a value indicating if the texture is depth texture.

Return value

Returns 1 if the texture is depth texture; otherwise, 0.

int isRawFormat ()

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.

int getNumLayers ()

Returns a number of layers in the texture.

Return value

Number of layers.

int getFormat ()

Gets the texture format.

Return value

Texture format.

void destroy ()

Destroys texture.

int fromD3D11Texture2D (void * ptr, int width, int height, int format, int internal_format, int flags)

Arguments

  • void * ptr
  • int width
  • int height
  • int format
  • int internal_format
  • int flags

Return value

int getGLInternalFormat ()

Returns OpenGL internal format.

Return value

OpenGL internal format.

int createMipmaps ()

Creates mipmaps stack.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

void * getD3D11RenderTargetView ()

Returns Direct3D11 render target view.

Return value

int getDepth ()

Returns the texture depth.

Return value

Texture depth.

int fromD3D11Texture2D (void * ptr, int width, int height, int format, int flags)

Arguments

  • void * ptr
  • int width
  • int height
  • int format
  • int flags

Return value

void bindCompute (int unit)

Binds compute texture.

Arguments

  • int unit - Texture unit.

int setImage (const Ptr<Image> & image)

Sets texture data.

Arguments

  • const Ptr<Image> & image - Image pointer.

Return value

Returns 1 if the operation was a success; otherwise, 0 is returned.

const char * getFormatName ()

Gets the texture format name.

Return value

Texture format name.

int isUCharFormat ()

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.

void unbindFragment (int unit)

Unbinds fragment texture.

Arguments

  • int unit - Texture unit.

int getGLTextureID ()

Returns OpenGL texture identifier.

Return value

OpenGL texture identifier.

int TEXTURE_2D

int TEXTURE_3D

int TEXTURE_CUBE

int TEXTURE_2D_ARRAY

int TEXTURE_CUBE_ARRAY

int FORMAT_R8

int FORMAT_RG8

int FORMAT_RGB8

int FORMAT_RGBA8

int FORMAT_R16

int FORMAT_RG16

int FORMAT_RGB16

int FORMAT_RGBA16

int FORMAT_R16U

int FORMAT_RG16U

int FORMAT_RGB16U

int FORMAT_RGBA16U

int FORMAT_R32U

int FORMAT_RG32U

int FORMAT_RGB32U

int FORMAT_RGBA32U

int FORMAT_R16F

int FORMAT_RG16F

int FORMAT_RGB16F

int FORMAT_RGBA16F

int FORMAT_R32F

int FORMAT_RG32F

int FORMAT_RGB32F

int FORMAT_RGBA32F

int FORMAT_RGB565

int FORMAT_RGBA4

int FORMAT_RGB5A1

int FORMAT_RGB10A2

int FORMAT_RG11B10F

int FORMAT_DXT1

int FORMAT_DXT3

int FORMAT_DXT5

int FORMAT_ATI1

int FORMAT_ATI2

int FORMAT_D16

int FORMAT_D24

int FORMAT_D24S8

int FORMAT_D32F

int FORMAT_D32FS8

int TYPE_2D_ARRAY

int TYPE_CUBE_ARRAY

int FORMAT_SRGB

int FORMAT_SIGNED

int FORMAT_INTEGER

int WRAP_CLAMP_X

int WRAP_CLAMP_Y

int WRAP_CLAMP_Z

int WRAP_CLAMP

int WRAP_BORDER_X

int WRAP_BORDER_Y

int WRAP_BORDER_Z

int WRAP_BORDER_W

int WRAP_BORDER

int FILTER_POINT

int FILTER_LINEAR

int FILTER_BILINEAR

int FILTER_TRILINEAR

int ANISOTROPY_1

int ANISOTROPY_2

int ANISOTROPY_4

int ANISOTROPY_8

int ANISOTROPY_16

int MULTISAMPLE_2

int MULTISAMPLE_4

int MULTISAMPLE_8

int MULTISAMPLE_16

int USAGE_IMMUTABLE

int USAGE_DYNAMIC

int USAGE_STAGING

int USAGE_RENDER

int USAGE_COMPUTE

int DEFAULT_FLAGS

Last update: 03.07.2017
Build: ()