* Support OpenGL ES 2 on Android
authorTim Angus <tim@blackcompanystudios.co.uk>
Fri, 26 Aug 2011 13:15:05 +0100
changeset 599075c796a375e1
parent 5989 cd688ba5b7d4
child 5991 fdb8cc53adaa
* Support OpenGL ES 2 on Android
android-project/src/org/libsdl/app/SDLActivity.java
     1.1 --- a/android-project/src/org/libsdl/app/SDLActivity.java	Thu Oct 13 16:35:25 2011 -0400
     1.2 +++ b/android-project/src/org/libsdl/app/SDLActivity.java	Fri Aug 26 13:15:05 2011 +0100
     1.3 @@ -1,6 +1,8 @@
     1.4  package org.libsdl.app;
     1.5  
     1.6 +import javax.microedition.khronos.egl.EGL10;
     1.7  import javax.microedition.khronos.egl.EGLConfig;
     1.8 +import javax.microedition.khronos.egl.EGLContext;
     1.9  import javax.microedition.khronos.opengles.GL10;
    1.10  import javax.microedition.khronos.egl.*;
    1.11  
    1.12 @@ -388,7 +390,13 @@
    1.13              }
    1.14              EGLConfig config = configs[0];
    1.15  
    1.16 -            EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, null);
    1.17 +            int EGL_CONTEXT_CLIENT_VERSION=0x3098;
    1.18 +            int contextAttrs[] = new int[]
    1.19 +            {
    1.20 +                EGL_CONTEXT_CLIENT_VERSION, majorVersion,
    1.21 +                EGL10.EGL_NONE
    1.22 +            }; 
    1.23 +            EGLContext ctx = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, contextAttrs);
    1.24              if (ctx == EGL10.EGL_NO_CONTEXT) {
    1.25                  Log.e("SDL", "Couldn't create context");
    1.26                  return false;
    1.27 @@ -424,7 +432,7 @@
    1.28          try {
    1.29              EGL10 egl = (EGL10)EGLContext.getEGL();
    1.30  
    1.31 -            egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
    1.32 +            egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);
    1.33  
    1.34              // drawing here
    1.35