-
Notifications
You must be signed in to change notification settings - Fork 2
raylib.UpdateTextureRec
JoeStrout edited this page Apr 29, 2026
·
3 revisions
Update GPU texture rectangle with new data NOTE 1: pixels data must match texture.format NOTE 2: pixels data must contain as many pixels as rec contains NOTE 3: rec must fit completely within texture's width and height
| Parameter | Default Value | Note |
|---|---|---|
| texture | ||
| rec | ||
| pixels |
None.
tex = raylib.LoadTexture("sprite.png")
rec = {x:0, y:0, width:32, height:32}
// RGBA data for the 32x32 region (all red)
pixels = char(255) + char(0) + char(0) + char(255)
pixels = pixels * (32 * 32)
raylib.UpdateTextureRec tex, rec, pixels
raylib.UnloadTexture tex