android - Getting Exception: FATAL EXCEPTION: GLThread No configs match configSpec -


i using below code multisampling make smooth edge. below code working on mobile , other mobile getting exception 'no configs match configspec.

please me solve issue.

thanks in advance.

package com.amplimesh.renderer;  import javax.microedition.khronos.egl.egl10; import javax.microedition.khronos.egl.eglconfig; import javax.microedition.khronos.egl.egldisplay;  import android.opengl.glsurfaceview; import android.util.log;  // class shows how use multisampling. use this, call //   myglsurfaceview.seteglconfigchooser(new multisampleconfigchooser()); // before calling setrenderer(). multisampling slow down // app -- measure performance , decide if vastly // improved visual quality worth cost. public class multisampleconfigchooser implements glsurfaceview.eglconfigchooser {     static private final string ktag = "gdc11";     @override     public eglconfig chooseconfig(egl10 egl, egldisplay display) {         mvalue = new int[1];          // try find normal multisample configuration first.         int[] configspec = {                 egl10.egl_red_size, 5,                 egl10.egl_green_size, 6,                 egl10.egl_blue_size, 5,                 egl10.egl_depth_size, 16,                 // requires seteglcontextclientversion(2) called on view.                 egl10.egl_renderable_type, 4 /* egl_opengl_es2_bit */,                 egl10.egl_sample_buffers, 1 /* true */,                 egl10.egl_samples, 2,                 egl10.egl_none         };          if (!egl.eglchooseconfig(display, configspec, null, 0,                 mvalue)) {             throw new illegalargumentexception("eglchooseconfig failed");         }         int numconfigs = mvalue[0];          if (numconfigs <= 0) {             // no normal multisampling config found. try create             // converage multisampling configuration, nvidia tegra2.             // see egl_nv_coverage_sample documentation.              final int egl_coverage_buffers_nv = 0x30e0;             final int egl_coverage_samples_nv = 0x30e1;              configspec = new int[]{                     egl10.egl_red_size, 5,                     egl10.egl_green_size, 6,                     egl10.egl_blue_size, 5,                     egl10.egl_depth_size, 16,                     egl10.egl_renderable_type, 4 /* egl_opengl_es2_bit */,                     egl_coverage_buffers_nv, 1 /* true */,                     egl_coverage_samples_nv, 2,  // 5 in practice on tegra 2                     egl10.egl_none             };              if (!egl.eglchooseconfig(display, configspec, null, 0,                     mvalue)) {                 throw new illegalargumentexception("2nd eglchooseconfig failed");             }             numconfigs = mvalue[0];              if (numconfigs <= 0) {                 // give up, try without multisampling.                 configspec = new int[]{                         egl10.egl_red_size, 5,                         egl10.egl_green_size, 6,                         egl10.egl_blue_size, 5,                         egl10.egl_depth_size, 16,                         egl10.egl_renderable_type, 4 /* egl_opengl_es2_bit */,                         egl10.egl_none                 };                  if (!egl.eglchooseconfig(display, configspec, null, 0,                         mvalue)) {                     throw new illegalargumentexception("3rd eglchooseconfig failed");                 }                 numconfigs = mvalue[0];                  if (numconfigs <= 0) {                     throw new illegalargumentexception("no configs match configspec");                 }             } else {                 musescoverageaa = true;             }         }          // matching configurations.         eglconfig[] configs = new eglconfig[numconfigs];         if (!egl.eglchooseconfig(display, configspec, configs, numconfigs,                 mvalue)) {             throw new illegalargumentexception("data eglchooseconfig failed");         }          // caution! eglchooseconfigs returns configs higher bit depth         // first: though asked rgb565 configurations, rgb888         // configurations considered "better" , returned first.         // need explicitly filter data returned eglchooseconfig!         int index = -1;         (int = 0; < configs.length; ++i) {             if (findconfigattrib(egl, display, configs[i], egl10.egl_red_size, 0) == 5) {                 index = i;                 break;             }         }         if (index == -1) {             log.w(ktag, "did not find sane config, using first");         }         eglconfig config = configs.length > 0 ? configs[index] : null;         if (config == null) {             throw new illegalargumentexception("no config chosen");         }         return config;     }      private int findconfigattrib(egl10 egl, egldisplay display,             eglconfig config, int attribute, int defaultvalue) {         if (egl.eglgetconfigattrib(display, config, attribute, mvalue)) {             return mvalue[0];         }         return defaultvalue;     }      public boolean usescoverageaa() {         return musescoverageaa;     }      private int[] mvalue;     private boolean musescoverageaa; } 

it looks requesting egl config test device doesn't support. not implementations support multisampling, want fall format that's supported on device. fallback format rgb565, , guess it's not supported on of target devices. try rgba8888 or rgba4444 instead, instance:

configspec = new int[] {         egl10.egl_red_size,        8,         egl10.egl_green_size,      8,         egl10.egl_blue_size,       8,         egl10.egl_alpha_size,      8,         egl10.egl_depth_size,      16,         egl10.egl_renderable_type, 4, /* egl_opengl_es2_bit */         egl10.egl_none }; 

as far know, rgba8888 16-bit depth buffer should available in relatively recent gles2 devices.


Comments

Popular posts from this blog

java - activate/deactivate sonar maven plugin by profile? -

python - TypeError: can only concatenate tuple (not "float") to tuple -

java - What is the difference between String. and String.this. ? -