multithreading - In Libgdx running on Android, load show() concurrently or parallel to render() -


i have time-sensitive application. several screens load during course of program calling show() similar screen.show().

but, show() has called while render() being called. can deal additional problems of managing parallel drawbacks (race conditions , dead locks). don't know if possible tell android spawn 2 glthreads ?

from documentation, , chasing around bug, learned libgdx components must initialized, rendered, , disposed of in glthread.

how can load libgdx components (sprite, texture, bitmapfonts etc) in background thread ?

libgdx on android supports 1 glthread, opengl operations must take place on thread. there 2 basic techniques avoid blocking glthread invoking render.

first, make sure non-gl operations on background threads (e.g., loading bytes disk, converting them correct format, etc). libgdx asset manager designed support.

second, instead of doing required opengl work in single step, break load or finer pieces, , 1 (or fewer pieces) @ time. example, load single sprite texture data opengl state during 1 render loop. believe if use assetmanager isloaded in preference update may semantic (but i'm not entirely sure how assetmanager batches opengl operations).


Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -