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?)
create view
caeagllayer
, createeaglcontext
on main threadcreate shared
eaglcontext
s used background threads via sharegroup values primary contextmake shared contexts current on background threads
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.
Comments
Post a Comment