Struct Texture

Texture for 2D and 3D.

struct Texture ;

A texture works by registering an image in the video hardware, which then can be used in 3D models or 2D Sprite or GUI Control. Textures are often created by loading them from a file. See @GDScript.load. Texture is a base for other resources. It cannot be used directly.

Properties

NameTypeDescription
flags[get, set] longThe texture's flags. flags are used to set various properties of the Texture.

Methods

NameDescription
draw Draws the texture using a CanvasItem with the VisualServer API at the specified position. Equivalent to VisualServer.canvasItemAddTextureRect with a rect at position and the size of this Texture.
drawRect Draws the texture using a CanvasItem with the VisualServer API. Equivalent to VisualServer.canvasItemAddTextureRect.
drawRectRegion Draws a part of the texture using a CanvasItem with the VisualServer API. Equivalent to VisualServer.canvasItemAddTextureRectRegion.
getData Returns an Image with the data from this Texture. Images can be accessed and manipulated directly.
getFlags
getHeight Returns the texture height.
getSize Returns the texture size.
getWidth Returns the texture width.
hasAlpha Returns true if this Texture has an alpha channel.
setFlags

Enums

NameDescription
Constants
Flags