Texture

Inherits: Resource < Reference < Object

Inherited By: RenderTargetTexture, AtlasTexture, ImageTexture, LargeTexture

Category: Core

Brief Description

Texture for 2D and 3D.

Member Functions

void draw ( RID canvas_item, Vector2 pos, Color modulate=Color(1,1,1,1), bool transpose=false ) const
void draw_rect ( RID canvas_item, Rect2 rect, bool tile, Color modulate=Color(1,1,1,1), bool transpose=false ) const
void draw_rect_region ( RID canvas_item, Rect2 rect, Rect2 src_rect, Color modulate=Color(1,1,1,1), bool transpose=false ) const
int get_flags ( ) const
int get_height ( ) const
RID get_rid ( ) const
Vector2 get_size ( ) const
int get_width ( ) const
bool has_alpha ( ) const
void set_flags ( int flags )

Numeric Constants

  • FLAG_MIPMAPS = 1 — Generate mipmaps, to enable smooth zooming out of the texture.
  • FLAG_REPEAT = 2 — Repeat (instead of clamp to edge).
  • FLAG_FILTER = 4 — Turn on magnifying filter, to enable smooth zooming in of the texture.
  • FLAG_VIDEO_SURFACE = 4096 — Texture is a video surface.
  • FLAGS_DEFAULT = 7 — Default flags. Generate mipmaps, repeat, and filter are enabled.
  • FLAG_ANISOTROPIC_FILTER = 8
  • FLAG_CONVERT_TO_LINEAR = 16
  • FLAG_MIRRORED_REPEAT = 32

Description

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.

Member Function Description

  • void draw ( RID canvas_item, Vector2 pos, Color modulate=Color(1,1,1,1), bool transpose=false ) const
  • void draw_rect ( RID canvas_item, Rect2 rect, bool tile, Color modulate=Color(1,1,1,1), bool transpose=false ) const
  • void draw_rect_region ( RID canvas_item, Rect2 rect, Rect2 src_rect, Color modulate=Color(1,1,1,1), bool transpose=false ) const
  • int get_flags ( ) const

Return the current texture flags.

  • int get_height ( ) const

Return the texture height.

  • RID get_rid ( ) const

Return the texture RID as used in the VisualServer.

Return the texture size.

  • int get_width ( ) const

Return the texture width.

  • bool has_alpha ( ) const
  • void set_flags ( int flags )

Change the texture flags.