Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Cleaned up OpenGL initialization a bit so we fail if we can't create …
- Loading branch information
Showing
with
13 additions
and
22 deletions.
-
+13
−22
android-project/src/org/libsdl/app/SDLActivity.java
|
@@ -268,10 +268,10 @@ public static void showTextInput(int x, int y, int w, int h) { |
|
|
|
|
|
// EGL functions |
|
|
public static boolean initEGL(int majorVersion, int minorVersion) { |
|
|
if (SDLActivity.mEGLDisplay == null) { |
|
|
//Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion); |
|
|
try { |
|
|
if (SDLActivity.mEGLDisplay == null) { |
|
|
Log.v("SDL", "Starting up OpenGL ES " + majorVersion + "." + minorVersion); |
|
|
|
|
|
try { |
|
|
EGL10 egl = (EGL10)EGLContext.getEGL(); |
|
|
|
|
|
EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); |
|
@@ -300,31 +300,20 @@ public static boolean initEGL(int majorVersion, int minorVersion) { |
|
|
} |
|
|
EGLConfig config = configs[0]; |
|
|
|
|
|
/*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; |
|
|
} |
|
|
SDLActivity.mEGLContext = ctx;*/ |
|
|
SDLActivity.mEGLDisplay = dpy; |
|
|
SDLActivity.mEGLConfig = config; |
|
|
SDLActivity.mGLMajor = majorVersion; |
|
|
SDLActivity.mGLMinor = minorVersion; |
|
|
} |
|
|
return SDLActivity.createEGLSurface(); |
|
|
|
|
|
SDLActivity.createEGLSurface(); |
|
|
} catch(Exception e) { |
|
|
Log.v("SDL", e + ""); |
|
|
for (StackTraceElement s : e.getStackTrace()) { |
|
|
Log.v("SDL", s.toString()); |
|
|
} |
|
|
} catch(Exception e) { |
|
|
Log.v("SDL", e + ""); |
|
|
for (StackTraceElement s : e.getStackTrace()) { |
|
|
Log.v("SDL", s.toString()); |
|
|
} |
|
|
return false; |
|
|
} |
|
|
else SDLActivity.createEGLSurface(); |
|
|
|
|
|
return true; |
|
|
} |
|
|
|
|
|
public static boolean createEGLContext() { |
|
@@ -364,8 +353,10 @@ public static boolean createEGLSurface() { |
|
|
} |
|
|
SDLActivity.mEGLSurface = surface; |
|
|
return true; |
|
|
} else { |
|
|
Log.e("SDL", "Surface creation failed, display = " + SDLActivity.mEGLDisplay + ", config = " + SDLActivity.mEGLConfig); |
|
|
return false; |
|
|
} |
|
|
return false; |
|
|
} |
|
|
|
|
|
// EGL buffer flip |
|
|