@@ -347,9 +347,9 @@ private class Cocos2dxEGLConfigChooser implements GLSurfaceView.EGLConfigChooser
347347 private int [] mConfigAttributes ;
348348 private final int EGL_OPENGL_ES2_BIT = 0x04 ;
349349 private final int EGL_OPENGL_ES3_BIT = 0x40 ;
350- public Cocos2dxEGLConfigChooser (int redSize , int greenSize , int blueSize , int alphaSize , int depthSize , int stencilSize )
350+ public Cocos2dxEGLConfigChooser (int redSize , int greenSize , int blueSize , int alphaSize , int depthSize , int stencilSize , int multisamplingCount )
351351 {
352- mConfigAttributes = new int [] {redSize , greenSize , blueSize , alphaSize , depthSize , stencilSize };
352+ mConfigAttributes = new int [] {redSize , greenSize , blueSize , alphaSize , depthSize , stencilSize , multisamplingCount };
353353 }
354354 public Cocos2dxEGLConfigChooser (int [] attributes )
355355 {
@@ -368,17 +368,34 @@ public EGLConfig chooseConfig(EGL10 egl, EGLDisplay display)
368368 EGL10 .EGL_ALPHA_SIZE , mConfigAttributes [3 ],
369369 EGL10 .EGL_DEPTH_SIZE , mConfigAttributes [4 ],
370370 EGL10 .EGL_STENCIL_SIZE , mConfigAttributes [5 ],
371+ EGL10 .EGL_SAMPLE_BUFFERS , (mConfigAttributes [6 ] > 0 ) ? 1 : 0 ,
372+ EGL10 .EGL_SAMPLES , mConfigAttributes [6 ],
371373 EGL10 .EGL_RENDERABLE_TYPE , EGL_OPENGL_ES2_BIT ,
372374 EGL10 .EGL_NONE
373375 },
374376 {
375- // GL ES 2 with user set
377+ // GL ES 2 with user set 16 bit depth buffer
376378 EGL10 .EGL_RED_SIZE , mConfigAttributes [0 ],
377379 EGL10 .EGL_GREEN_SIZE , mConfigAttributes [1 ],
378380 EGL10 .EGL_BLUE_SIZE , mConfigAttributes [2 ],
379381 EGL10 .EGL_ALPHA_SIZE , mConfigAttributes [3 ],
380382 EGL10 .EGL_DEPTH_SIZE , mConfigAttributes [4 ] >= 24 ? 16 : mConfigAttributes [4 ],
381383 EGL10 .EGL_STENCIL_SIZE , mConfigAttributes [5 ],
384+ EGL10 .EGL_SAMPLE_BUFFERS , (mConfigAttributes [6 ] > 0 ) ? 1 : 0 ,
385+ EGL10 .EGL_SAMPLES , mConfigAttributes [6 ],
386+ EGL10 .EGL_RENDERABLE_TYPE , EGL_OPENGL_ES2_BIT ,
387+ EGL10 .EGL_NONE
388+ },
389+ {
390+ // GL ES 2 with user set 16 bit depth buffer without multisampling
391+ EGL10 .EGL_RED_SIZE , mConfigAttributes [0 ],
392+ EGL10 .EGL_GREEN_SIZE , mConfigAttributes [1 ],
393+ EGL10 .EGL_BLUE_SIZE , mConfigAttributes [2 ],
394+ EGL10 .EGL_ALPHA_SIZE , mConfigAttributes [3 ],
395+ EGL10 .EGL_DEPTH_SIZE , mConfigAttributes [4 ] >= 24 ? 16 : mConfigAttributes [4 ],
396+ EGL10 .EGL_STENCIL_SIZE , mConfigAttributes [5 ],
397+ EGL10 .EGL_SAMPLE_BUFFERS , 0 ,
398+ EGL10 .EGL_SAMPLES , 0 ,
382399 EGL10 .EGL_RENDERABLE_TYPE , EGL_OPENGL_ES2_BIT ,
383400 EGL10 .EGL_NONE
384401 },
0 commit comments