说明:此问题只出现在cocos2d-x 3.0和3.1.0版本上,3.1.1已经将此bug修复
不知为何,看了代码,appActivity.jave 继承了Cocos2dxActivity.java在OnCreatView()函数中,新创建了一个view,在init中新创建的view调用了
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
似乎重置了参数,所以我们在AppActivity.java 中重构public Cocos2dxGLSurfaceView onCreateView()函数
改写为
public Cocos2dxGLSurfaceView onCreateView(){ Cocos2dxGLSurfaceView glSurfaceView = new Cocos2dxGLSurfaceView(this); glSurfaceView.setEGLConfigChooser(5, 6, 5, 0, 16, 8); return glSurfaceView; }
int Application::runEx()
{
PVRFrameEnableControlWindow(false);
// Main message loop:
LARGE_INTEGER nFreq;
QueryPerformanceFrequency(&nFreq);
QueryPerformanceCounter(&_nLast);
initGLContextAttrs();