說明:此問題只出現在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();