Skip to content

AtlasTexture

Narta Xaymar Dirks edited this page Oct 28, 2026 · 2 revisions

AtlasTexture

AtlasTexture:Int32 atlas:Int32, x:Int32, y:Int32, width:Int32, height:Int32
Parameter Mode Type Default Description
atlas In Int32 required A texture made by LoadAtlas.
x In Int32 required Left edge of the rectangle in pixels.
y In Int32 required Top edge of the rectangle in pixels.
width In Int32 required Width of the rectangle in pixels.
height In Int32 required Height of the rectangle in pixels.

Returns: A texture handle, or 0 if the rectangle is not completely inside the atlas.

Description

Returns a texture that shows one rectangle of a texture atlas made with LoadAtlas. The rectangle is given in pixels. The new texture has no picture of its own: it uses the image of the atlas, and only remembers which part of it to show, so it costs next to nothing. The result is used like any other texture, with EntityTexture, BrushTexture and so on. TextureWidth and TextureHeight tell the size of the rectangle.

Each tile has its own ScaleTexture, PositionTexture, RotateTexture, TextureBlend and TextureCoords settings, which work inside the rectangle (like frames of LoadAnimTexture, the coordinates do not repeat inside the tile, so values beyond 0 to 1 show the neighbouring tiles). The flags are the ones of the atlas; mip maps are only used if the atlas was loaded with a gutter.

Without a gutter (see LoadAtlas) the tile uses the first mip level only, and to keep the neighbouring tile out of linear filtering, the rectangle is shrunk by half a texel on every side. A tile therefore looks very slightly zoomed in, and nothing of what is next to it can shine through. With the point flag (1024) the tile is exact.

FreeTexture on a tile only frees the tile. TextureBuffer and SaveTexture are not available for tiles: use the atlas.

Related Commands

CreateTexture, FreeTexture, LoadAnimTexture, LoadTexture, PositionTexture, RotateTexture, SaveTexture 〔BlitzLLVM〕, ScaleTexture

Home · Command Index



Differences
Language Features
BlitzBasic
Blitz3D
BlitzPlus

Clone this wiki locally