* Support OpenGL ES 2 on Android
authorTim Angus <tim@blackcompanystudios.co.uk>
Fri, 26 Aug 2011 13:15:05 +0100
changeset 5990 75c796a375e1
parent 5989 cd688ba5b7d4
child 5991 fdb8cc53adaa
* Support OpenGL ES 2 on Android
android-project/src/org/libsdl/app/SDLActivity.java
--- a/android-project/src/org/libsdl/app/SDLActivity.java	Thu Oct 13 16:35:25 2011 -0400
+++ b/android-project/src/org/libsdl/app/SDLActivity.java	Fri Aug 26 13:15:05 2011 +0100
@@ -1,6 +1,8 @@
 package org.libsdl.app;
 
+import javax.microedition.khronos.egl.EGL10;
 import javax.microedition.khronos.egl.EGLConfig;
+import javax.microedition.khronos.egl.EGLContext;
 import javax.microedition.khronos.opengles.GL10;
 import javax.microedition.khronos.egl.*;
 
@@ -388,7 +390,13 @@
             }
             EGLConfig config = configs[0];
 
-            EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, null);
+            int EGL_CONTEXT_CLIENT_VERSION=0x3098;
+            int contextAttrs[] = new int[]
+            {
+                EGL_CONTEXT_CLIENT_VERSION, majorVersion,
+                EGL10.EGL_NONE
+            }; 
+            EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, contextAttrs);
             if (ctx == EGL10.EGL_NO_CONTEXT) {
                 Log.e("SDL", "Couldn't create context");
                 return false;
@@ -424,7 +432,7 @@
         try {
             EGL10 egl = (EGL10)EGLContext.getEGL();
 
-            egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
+            egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
 
             // drawing here