android - LibGDX Saving textures to avoid context loss -
android - LibGDX Saving textures to avoid context loss -
i have texture in libgdx based android app created procedurally through framebuffers need preserve through context loss, , seems efficient way save data, whether total image or raw data, out, , load in when time comes. i'm struggling find way accomplish though, every route i've taken has lead finish failure in 1 way or another.
i've searched around quite bit, nil i've come across has worked out. looking hint right direction, rather aimless searching , attempts have been doing far. assume best thing convert of info texture "buffer" of sort, save info internally, , reload , recreate texture, i'm not sure best way go doing is.
the pixmapio
class supposed help writing run-time generated pixmap out. not quite you're looking fbo texture, though. (its easy go pixmap
texture
, not easy go other way.) if primitives utilize generate info in fbo available on pixmap
(e.g., basic geometric primitives), may alternative. believe closest libgdx comes supported mechanism saving run-time texture, i'm not positive.
there libgdx code around scraping bytes off framebuffer (the texture info of fbo lives on gpu, need jump through hoops re-create normal memory). see screenutils
, the links here screenshots , pngs.
it should easy adapt pixmapio
write out "cim" formatted file using byte[]
returned on of screenutils
methods.
alternatively, track list of "operations" done fbo, can replay them (reconstructing content later). depends lot on what's going texture, though ...
android libgdx textures buffer
Comments
Post a Comment