Cleaned up OpenGL initialization a bit so we fail if we can't create a surface.
This commit is contained in:
parent
175397ca41
commit
8e886bcdeb
1 changed files with 14 additions and 23 deletions
|
@ -268,10 +268,10 @@ public class SDLActivity extends Activity {
|
|||
|
||||
// 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 class SDLActivity extends Activity {
|
|||
}
|
||||
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;
|
||||
|
||||
SDLActivity.createEGLSurface();
|
||||
} catch(Exception e) {
|
||||
Log.v("SDL", e + "");
|
||||
for (StackTraceElement s : e.getStackTrace()) {
|
||||
Log.v("SDL", s.toString());
|
||||
}
|
||||
}
|
||||
}
|
||||
else SDLActivity.createEGLSurface();
|
||||
return SDLActivity.createEGLSurface();
|
||||
|
||||
return true;
|
||||
} catch(Exception e) {
|
||||
Log.v("SDL", e + "");
|
||||
for (StackTraceElement s : e.getStackTrace()) {
|
||||
Log.v("SDL", s.toString());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public static boolean createEGLContext() {
|
||||
|
@ -364,8 +353,10 @@ public class SDLActivity extends Activity {
|
|||
}
|
||||
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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue