Skip to content
This repository has been archived by the owner. It is now read-only.
Permalink
Browse files

* Support OpenGL ES 2 on Android

  • Loading branch information
Tim Angus committed Aug 26, 2011
1 parent 76cfa29 commit f9872405f2c47dfd5a50e88ec963a6474e9e5117
Showing with 10 additions and 2 deletions.
  1. +10 −2 android-project/src/org/libsdl/app/SDLActivity.java
@@ -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 @@ public boolean initEGL(int majorVersion, int minorVersion) {
}
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 @@ public void flipEGL() {
try {
EGL10 egl = (EGL10)EGLContext.getEGL();

egl.eglWaitNative(EGL10.EGL_NATIVE_RENDERABLE, null);
egl.eglWaitNative(EGL10.EGL_CORE_NATIVE_ENGINE, null);

// drawing here

0 comments on commit f987240

Please sign in to comment.