зеркало из https://github.com/microsoft/cocos2d-x.git
do not use custom EGLContextFactory (#18062)
it will crash on some devices
This commit is contained in:
Родитель
17f2a12a28
Коммит
78e2bf5f93
|
@ -267,10 +267,9 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
//this line is need on some device if we specify an alpha bits
|
||||
if(this.mGLContextAttrs[3] > 0) glSurfaceView.getHolder().setFormat(PixelFormat.TRANSLUCENT);
|
||||
|
||||
// use custom EGLConfigureChooser and EGLContextFactory
|
||||
// use custom EGLConfigureChooser
|
||||
Cocos2dxEGLConfigChooser chooser = new Cocos2dxEGLConfigChooser(this.mGLContextAttrs);
|
||||
glSurfaceView.setEGLConfigChooser(chooser);
|
||||
glSurfaceView.setEGLContextFactory(new ContextFactory());
|
||||
|
||||
return glSurfaceView;
|
||||
}
|
||||
|
@ -381,23 +380,4 @@ public abstract class Cocos2dxActivity extends Activity implements Cocos2dxHelpe
|
|||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private static class ContextFactory implements GLSurfaceView.EGLContextFactory {
|
||||
|
||||
private static int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
|
||||
|
||||
public EGLContext createContext(
|
||||
EGL10 egl, EGLDisplay display, EGLConfig eglConfig) {
|
||||
|
||||
int[] attributes = {EGL_CONTEXT_CLIENT_VERSION, 2, EGL10.EGL_NONE };
|
||||
EGLContext context = egl.eglCreateContext(
|
||||
display, eglConfig, EGL10.EGL_NO_CONTEXT, attributes);
|
||||
|
||||
return context;
|
||||
}
|
||||
|
||||
public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
|
||||
egl.eglDestroyContext(display, context);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,6 +94,7 @@ public class Cocos2dxGLSurfaceView extends GLSurfaceView {
|
|||
}
|
||||
|
||||
protected void initView() {
|
||||
this.setEGLContextClientVersion(2);
|
||||
this.setFocusableInTouchMode(true);
|
||||
|
||||
Cocos2dxGLSurfaceView.mCocos2dxGLSurfaceView = this;
|
||||
|
|
Загрузка…
Ссылка в новой задаче