I'm trying to to use GLSL for OpenGL ES 3.0 with OpenGL ES Context 2.0 on Android Emulator Nexus 6 API 24. I declare in my vertex shader and fragment shader with
"#version 300 es"
But I got error: "unsupported shader version". After searching around, I think that maybe changing to OpenGL ES Context 3.0 would solve my problem. Therefore, I edit my GLES3JNIView.java (from this sample: https://github.com/googlesamples/android-ndk/tree/master/gles3jni/app/src/main/java/com/android/gles3jni).
Change the context from 2 to 3 with
setEGLContextClientVersion(3);
and edit the manifest:
< uses-feature android:glEsVersion="0x00030000" android:required="true" />
But I ran into another problem, when I run the app, it crashes on launching. I found these in the logcat:
02-14 17:29:04.879 5546-5546/? I/art: Not late-enabling -Xcheck:jni (already on)
02-14 17:29:04.879 5546-5546/? W/art: Unexpected CPU variant for X86 using defaults: x86
02-14 17:29:05.215 5546-5568/com.android.gl2jni I/OpenGLRenderer: Initialized EGL, version 1.4
02-14 17:29:05.215 5546-5568/com.android.gl2jni D/OpenGLRenderer: Swap behavior 1
02-14 17:29:05.313 5546-5568/com.android.gl2jni E/EGL_emulation: tid 5568: eglSurfaceAttrib(1146): error 0x3009 (EGL_BAD_MATCH)
02-14 17:29:05.313 5546-5568/com.android.gl2jni W/OpenGLRenderer: Failed to set EGL_SWAP_BEHAVIOR on surface 0xa917dca0, error=EGL_BAD_MATCH
[ 02-14 17:29:05.430 5546: 5565 D/ ]
HostConnection::get() New Host Connection established 0xacd1d780, tid 5565
02-14 17:29:05.435 5546-5565/com.android.gl2jni E/AndroidRuntime: FATAL EXCEPTION: GLThread 157
Process: com.android.gl2jni, PID: 5546
java.lang.IllegalArgumentException: eglChooseConfig failed
at android.opengl.GLSurfaceView$BaseConfigChooser.chooseConfig(GLSurfaceView.java:865)
at android.opengl.GLSurfaceView$EglHelper.start(GLSurfaceView.java:1036)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1416)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1253)
What am I doing wrong?