我使用以下的混合模式在win32上可以正确运行,但在android上没有效果,android不支持这样的混合模式吗 ?
blendFunc.src = GL_ONE_MINUS_DST_ALPHA;
blendFunc.dst = GL_ONE;
发现是混合后的alpha值没有变化,如采用ccBlendFunc blendFunc = { GL_ZERO, GL_ONE_MINUS_SRC_ALPHA };混合后源图的部分应该是透明的,但是没有,不知道为什么 ?
我使用GLint alpha_bits;
glGetIntegerv(GL_ALPHA_BITS, &alpha_bits);
在win32上得到的是8,在android上等到的是零。跟踪发现是调用eglMakeCurrent后设置的,不知道android怎么设置?
问题解决:
Specifying the android.view.Surface
By default GLSurfaceView will create a PixelFormat.RGB_565 format surface. If a translucent surface is required, call getHolder().setFormat(PixelFormat.TRANSLUCENT). The exact format of a TRANSLUCENT surface is device dependent, but it will be a 32-bit-per-pixel surface with 8 bits per component.
在setRender之前调用setEGLConfigChooser(8, 8, 8, 8, 16, 0);
getHolder().setFormat(PixelFormat.TRANSLUCENT);即可