Though I found a question about Sharing the GLES20 context..., I think my situation is a bit more broad.
I've got two GLSurfaceView
s layered on each other in a FrameLayout
. (One is Harism's CurlView from android_page_curl running as a library in my application. The other GLSurfaceView is my own.) Each GLSurfaceView is being run in its own thread.
I'm having inconsistent issues with displaying bitmaps on my GLSurfaceView. Sometimes the bitmap is drawn perfectly, and sometimes only parts of it are visible. I bet the two GLSurfaceViews are competing for access to the screen memory and trampling on each other.
To solve it, I was thinking I can just synchronize
on an a singleton boolean in the application before calling onDrawFrame()
, but after reading Threading lightly... I think I should be a bit more thoughtful.
On what object, and around what code should I synchronize
to make the two overlayed GLSurfaceViews play nicely?