說明:此問題只出現(xiàn)在cocos2d-x 3.0和3.1.0版本上,3.1.1已經(jīng)將此bug修復(fù)
不知為何,看了代碼,appActivity.jave 繼承了Cocos2dxActivity.java在OnCreatView()函數(shù)中,新創(chuàng)建了一個(gè)view,在init中新創(chuàng)建的view調(diào)用了
this.mGLSurfaceView.setEGLConfigChooser(8 , 8, 8, 8, 16, 0);
似乎重置了參數(shù),所以我們?cè)贏ppActivity.java 中重構(gòu)public Cocos2dxGLSurfaceView onCreateView()函數(shù)
改寫為
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();