I'm using openGL on android, at the time of emulating the error

0

I'm testing an example found on the internet and at the time of execution gives me the following error in LogCat

  

03-23 09: 43: 22.286: E / AndroidRuntime (1036): FATAL EXCEPTION: GLThread   72 03-23 09: 43: 22.286: E / AndroidRuntime (1036): Process:   com.bomprogramador.game.openglbasico2, PID: 1036 03-23 09: 43: 22.286:   E / AndroidRuntime (1036): java.lang.IllegalArgumentException: No config   chosen 03-23 09: 43: 22.286: E / AndroidRuntime (1036): at   android.opengl.GLSurfaceView $ BaseConfigChooser.chooseConfig (GLSurfaceView.java:874)   03-23 09: 43: 22.286: E / AndroidRuntime (1036): at   android.opengl.GLSurfaceView $ EglHelper.start (GLSurfaceView.java:1024)   03-23 09: 43: 22.286: E / AndroidRuntime (1036): at   android.opengl.GLSurfaceView $ GLThread.guardedRun (GLSurfaceView.java:1401)   03-23 09: 43: 22.286: E / AndroidRuntime (1036): at   android.opengl.GLSurfaceView $ GLThread.run (GLSurfaceView.java:1240)

Someone would know how to correct such a mistake.

    
asked by anonymous 23.03.2015 / 14:53

1 answer

2

Two important facts:

  • The emulator is not fully guaranteed . Your code can be perfect, and yet fail catastrophically in it.
  • Between version 2.x and Android 4.x, certain behaviors change . The code that worked in 2.2 / 2.3 may not work the same way in 4.4.
  • Solution:

  • Call setEGLContextClientVersion(2);
  • Calling setEGLConfigChooser(8, 8, 8, 8, 16, 0); using default values
  • For example:

    public class GameSurfaceView extends GLSurfaceView {
        private GameRenderer renderer;
    
        public GameSurfaceView(Context context) {
            super(context);
            setEGLContextClientVersion(2);
            setEGLConfigChooser(8, 8, 8, 8, 16, 0);
            renderer = new GameRenderer();//aonde GameRenderer implements GLSurfaceView.Renderer
            setRenderer(renderer);
        }
    }
    

    Remembering that GameRenderer and GameSurfaceView are your responsibility classes. I do not know what name you gave these classes in your project.

        
    26.03.2015 / 02:10