I'm not sure if I understand you correctly when exactly you set the format. It sounds too me as if you're setting it "too late", after the OpenGL ES context has been created.
What I do is setting the format in the Activity's onCreate method on the UI thread before the OpenGL context is initialized and before a renderer has been set. Maybe your setFormat call is postponed in a way so you lose the OpenGL context and it forces a re-creation? I guess it just works for you on different devices because your call to setFormat does not actually change the format, so nothing happens. Your older 2.2 Android device may have a different default format for the surface view (such as RGB565) compared to newer devices. On Friday, August 23, 2013 1:11:57 PM UTC-5, latimerius wrote: > > 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 [email protected] To unsubscribe from this group, send email to [email protected] 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 [email protected]. For more options, visit https://groups.google.com/groups/opt_out.

