1

I've been reading the online documentation, and skimming through a couple of android/OpenGL books.. and it all mentioned that one way to pass or delegate event handlers calls to the GL Rendering thread is to use Android queueEvent(new Runnable(){...}) from GLSurfaceView Class.. which based on my humble java knowledge didn't make any sense..then I found this question GLSurfaceView.queueEvent does not execute in the GL thread in thee comments someone confirmed my doubts by saying that calling runnable pretty much imply that you want each instance of this class to run in a separate thread?. Yet another person said this isn't true in this particular case and that queueEvent takes that runnable, and runs it on the existing renderer thread

If the second person is right, my question is... what if I have two separate threads that execute GLRenderer... in this case which thread will execute the code that the new queueEvent(new Runnable()) host?!! I'm so confused..

1 Answer 1

2

Not sure where, or how (or even why) you will start another thread that runs the code in your Renderer class, however regardless, GLSurfaceView create a thread when you call setRenderer(), and it maintain a reference to this thread. You typically call queueEvent(new Runnable() { public void run() { mMyRenderer.DoSomething(); }); from inside the GLSurfaceView, which has a reference to the thread it created! it doesn't matter if you have another thread that also host your rendered, it might not even visible to GLSurfaceView.. bottom-line... queueEvent work with the thread referenced (and created) by GLSurfaceView

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.