alloc_surface(3)
π alloc_surface(3) π
okay so real quick β this page is from the Arcan Lua API manual, and it's genuinely one of the handiest little calls in the whole thing, so buckle up bestie π
β¨ NAME β¨
alloc_surface β creates an empty, non-visible surface with a preset storage. that's it, that's the whole vibe π
π¦ SYNOPSIS π¦
vid
alloc_surface( int:width, int:height )
alloc_surface( int:width, int:height, bool:noalpha )
alloc_surface( int:width, int:height, bool:noalpha, int:quality )
three flavours, pick your fighter π
πΈ DESCRIPTION πΈ
so like, some operations β especially record and rendertargets β literally need a storage buffer to work with. they can't just manifest one out of pure main character energy, they need somewhere to put pixels.
now, you could use fill_surface for those operations too, but alloc_surface is giving efficiency queen: it results in one less transfer. and optionally you get some control over the storage format and quality. obsessed. π₯
here's the tea on the args:
- if
noalphais set (true,!0) the texture format for the underlying backing store will be set to one where the alpha channel corresponds to fullbright (ignore/nobright). no half-transparent nonsense, we're going full send π qualitycan be set to one of the following:ALLOC_QUALITY_LOWALLOC_QUALITY_NORMALALLOC_QUALITY_HIGHALLOC_QUALITY_FLOAT 16ALLOC_QUALITY_FLOAT 32
π§ NOTES π§
- only
ALLOC_QUALITY_NORMALis guaranteed to be a valid target formap_video_displayand similar operations. the others are living dangerously, and honestly? respect. π - note that not all storage modes will support all forms of filtering, or mipmapping. if in doubt, disable
vfilterand manually sample in a shader. ngl that's the safe play, no cap β¨
heads up bestie β those two notes are the difference between "slay" and "why is my render target doing that". read them twice. π«Ά
β EXAMPLE β
function alloc_surface0()
local vid = fill_surface(640, 480);
assert(vid ~= BADID)
print("allocated: ", vid, 640, 480);
show_image(vid);
end
look at her go π allocating at 640 Γ 480, checking it against BADID like a responsible icon, printing, then show_image. we love a full pipeline. π
π MISUSE π
function alloc_surface0()
fill_surface(-1, -1);
end
negative dimensions? absolutely not. that's a vibe check failure fr fr π
π MISUSE π
function alloc_surface1()
fill_surface(1000000, 100000000);
end
a million by a hundred million. bestie. bestie. that is not a surface, that's a cry for help π your GPU is not ok
π SEE ALSO: π
image
okay that's the whole page, you're officially caught up π stay hydrated, keep your quality at ALLOC_QUALITY_NORMAL unless you know exactly what you're doing, and remember: this gem comes to you from the Arcan Lua API manual, dated October 2026 β see you in the next group chat, mwah πππ¦
π¦ where this page comes from
- nixos 26.05: arcan 0.7.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms