I have a problem with setting up OpenGL ES 1.1 with alpha channel support.

First of all: I need an alpha channel within OpenGL ES for performing alpha 
masking and blending effects. My game uses a texture with alpha channel for 
masking another texture. This only happens to work when I initialize OpenGL 
ES with the following configuration:

glView.setEGLConfigChooser(8, 8, 8, 8, 0, 8);

I could use the stencil buffer instead and parts of my game do that, too. 
However, my Nexus 7 tablet crashes pretty hard with a colorfully distorted 
screen when I use the stencil buffer in conjunction with alpha testing 
(which is necessary for discarding transparent pixels in the masking 
texture):

gl.glEnable(GL10.GL_ALPHA_TEST);
gl.glAlphaFunc(GL10.GL_GREATER, 0.05f);

Romain Guy says 
here<https://groups.google.com/d/msg/android-developers/enRw0sImmN0/uXPWFJ7fQzcJ>that
 the alpha channel set in setEGLConfigChooser does not need to be used 
unless the window is translucent. However, when I compile my game with:

glView.setEGLConfigChooser(8, 8, 8, 0, 0, 8); // alpha = 0

My texture masking effect does not work anymore. Instead I can only see the 
unmasked texture hovering as a square on the screen. All other textures 
with alpha channel are rendered correctly but only when I don't try to 
alpha-mask them.

I could leave the configuration with 8 bits alpha channel. However, then I 
get on some older devices crashes with an EGL_BAD_MATCH  error because 
their surface view apparently only supports RGB565 or maybe even something 
worse than that.

I tried fixing the problem as follows:

glView.setEGLConfigChooser(5, 6, 5, 8, 0, 8);

But that does not work either (config chooser cannot find a matching 
configuration). What can I do in this situation? How can I keep my alpha 
channel within OpenGL ES (I don't need it for the surface nor the window) 
and make older devices happy without crashing right on initialization?

-- 
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