DRAWING FUNCTIONS

LoadTexture

Loads an image from disk and returns a texture handle.

Syntax

local texId, w, h = ONYX.LoadTexture(path)

Parameters

  • path (string) — Image file: PNG, JPG/JPEG, BMP, GIF or TGA.

Return(s)

texId (number), w (number), h (number) — texture handle and pixel size.

Behavior

  • Decodes through stb_image into RGBA8 and uploads a shader resource view.
  • GIF files load only the first frame.
  • Keep texId alive until you call ReleaseTexture.

Example(s)

local texId, w, h = ONYX.LoadTexture("logo.png")