Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

PortableCompressedTexture2D

Inherits: Texture2D < Texture < Resource < RefCounted < Object

Provides a compressed texture for disk and/or VRAM in a way that is portable.

Description

This class allows storing compressed textures as self contained (not imported) resources.

For 2D usage (compressed on disk, uncompressed on VRAM), the lossy and lossless modes are recommended. For 3D usage (compressed on VRAM) it depends on the target platform.

If you intend to only use desktop, S3TC or BPTC are recommended. For only mobile, ETC2 is recommended.

For portable, self contained 3D textures that work on both desktop and mobile, Basis Universal is recommended (although it has a small quality cost and longer compression time as a tradeoff).

This resource is intended to be created from code.

Properties

PackedByteArray

_data

PackedByteArray()

bool

keep_compressed_buffer

false

bool

resource_local_to_scene

false (overrides Resource)

Vector2

size_override

Vector2(0, 0)

Methods

void

create_from_image ( Image image, CompressionMode compression_mode, bool normal_map=false, float lossy_quality=0.8 )

CompressionMode

get_compression_mode ( ) const

Format

get_format ( ) const

bool

is_keeping_all_compressed_buffers ( ) static

void

set_keep_all_compressed_buffers ( bool keep ) static