In a testing program I'm playing with currently, I want to use setFormat()
to adapt the pixel format of my surface to the chosen EGL config before I
pass the surface holder to eglCreateWindowSurface().

Now, I call EGL from my render thread and I know SurfaceHolder.setFormat()
is documented to have to be "called from the same thread running the
SurfaceView's window", which I take to be the main thread.  To comply, I
wrap my setFormat() call in a Runnable which I pass to runOnUiThread() and
wait() until it's actually executed.

This works perfectly on some devices, however it gives me intermittent
failures on Optimus One (with Android 2.2)  - on program start-up, three
times out of four the screen is just black.  Even if start-up goes right,
the first configuration change makes the screen go black.  The program
still runs and no GL or EGL calls signal any errors.

Here's the weirdest part - if I omit the runOnUiThread() stuff and simply
call setFormat() from my render thread, it fixes the problem and the
program runs 100% solid on Optimus no matter much beating I give it -
randomly pressing Home and Back while rotating the device wildly, putting
it to sleep and waking it back up, the renderer always handles the native
window changes correctly and renders just fine.

I'm at a loss, does anyone have an explanation?

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
--- 
You received this message because you are subscribed to the Google Groups 
"Android Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to android-developers+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to