Reputation: 909
When controlling OpenGL from other threads, if it is GLSurfaceView, we use queueEvent(). Then, in cases where OpenGL is created on SurfaceView (use eglCreateWindowSurface, eglMakeCurrent, etc.), how should I implement for operating OpenGL from other threads?
Upvotes: 1
Views: 917
Reputation: 1162
You can implement your own queueEvent
.
ArrayList<Runnable> mQueue
) queueEvent()
adds Runnable
instances to this queue(mQueue
).SurfaceView
's rendering thread pops event
from the queue.event.run()
Use locks (synchronized
or explicit locks) to avoid problems.
In GLSurfaceView
, there are 3 and 4 steps in a loop of GLThread and mQueue
is protected by synchronized
blocks.
see also: GLSurfaceView
PS: sorry for my poor english.
Upvotes: 1