Skip to content
This repository has been archived by the owner on Feb 11, 2021. It is now read-only.

Commit

Permalink
Browse files Browse the repository at this point in the history
* Support OpenGL ES 2 on Android
  • Loading branch information
Tim Angus committed Aug 26, 2011
1 parent 76cfa29 commit f987240
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions 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.*;

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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

Expand Down

0 comments on commit f987240

Please sign in to comment.