egl - Apportable - How do I run OpenGL on a background thread? -


i of rendering on background thread. currently, have working on ios using caeagllayer in uiview subclass, , doing of opengl spin-up on background thread (including binding layer via...:

[context renderbufferstorage:gl_renderbuffer fromdrawable:layer]; 

...) however, when try on android, apportable compatibility layer triggers errors in egl because trying use egl surface thread...:

09-24 12:25:04.667    2622-2661/com.apportable.spin e/eglhelper﹕ eglswapbuffers returned 12301. tid=1535 09-24 12:25:04.677    2622-2661/com.apportable.spin w/adreno200-egl﹕ <qegldrvapi_eglswapbuffers:3415>: egl_bad_surface 

how can rendering on bg thread? there apportable thread documentation (e.g. android ui thread used run ios main thread? or separate thread?)

  1. create view caeagllayer , create eaglcontext on main thread

  2. create shared eaglcontexts used background threads via sharegroup values primary context

  3. make shared contexts current on background threads

  4. be careful using libdispatch , contexts (ideally should use nsthread methods running things on main thread) specifically, beware optimization documented dispatch_sync.

the apportable threading model bit non-standard compared common android one. due fact ios runs opengl in it's main thread. thread application started on same thread initial opengl surface created on. interesting ramification our android based views created , managed in gl thread (by clever manipulations of looper/messagequeue , dialog constructs). long first opengl context reference in objective-c on main thread; things shared contexts should work expected. if not case things devolve quickly. ideally should create shared contexts swap background threads based off of primary context created main thread.

more @ the apportable discussion group


Comments

Popular posts from this blog

c# - How Configure Devart dotConnect for SQLite Code First? -

java - Copying object fields -

c++ - Clear the memory after returning a vector in a function -