I've seen multiple takes on this topic and its starting to confuse me. I really hope someone can give me a definitive answer! :)
I guess to be blunt: does the Android emulator support OpenGL ES 2.0? I've seen some people say "Yes, but you have to change a few settings." and I've also seen "No, it doesn't support it, period." Here's what I've done to try and correct the problem, including some error messages that I got.
First, I modified the AndroidManifest.xml to contain the following code:
<uses-feature
android:glEsVersion="0x00020000" />
<uses-sdk
android:minSdkVersion="15"
android:targetSdkVersion="17" />
Then, when I want to instantiate my GLSurfaceView, I use this sequence of code to instantiate it:
super(context);
setEGLContextClientVersion(2);
setRenderer(new MyRenderer());
setRenderMode(GLSurfaceView.RENDERMODE_WHEN_DIRTY);
Then, everywhere I looked said that you must go into the AVD Manager, select the emulator, go to "Hardware", add "GPU emulation" and set the boolean to "yes". However, here is what I see when I look at mine:
What's peculiar is that I have another emulator in my AVD Manager of which I do have the "Hardware" table:
And just to show you exactly what I'm doing, here's some code that does some stuff I want to do in OpenGL ES 2.0 (I mainly got this from Android's own tutorials):
int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexShaderCode);
int fragmentShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentShaderCode);
program = GLES20.glCreateProgram();
GLES20.glAttachShader(program, vertexShader);
GLES20.glAttachShader(program, fragmentShader);
GLES20.glLinkProgram(program);
I don't want to change my code back to work with OpenGL ES 1.0 because that will require a lot of headaches and if I can avoid it, I will.
Finally, when I try running my program, the program closes with the window: "Unfortunately, has stopped." This is what LogCat told me:
12-05 06:16:27.165: E/AndroidRuntime(936): FATAL EXCEPTION: GLThread 81
12-05 06:16:27.165: E/AndroidRuntime(936): java.lang.IllegalArgumentException: No config chosen
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:874)
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1024)
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1401)
12-05 06:16:27.165: E/AndroidRuntime(936): at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1240)
I will say I am not an expert on this at all and this is my first experience with OpenGL. If anybody has any ideas of what I can do to fix this, I would be forever grateful. :) Thank you!