diff options
Diffstat (limited to 'opengl/java')
-rw-r--r-- | opengl/java/android/opengl/GLUtils.java | 49 |
1 files changed, 48 insertions, 1 deletions
diff --git a/opengl/java/android/opengl/GLUtils.java b/opengl/java/android/opengl/GLUtils.java index f30a4cd..125c56e 100644 --- a/opengl/java/android/opengl/GLUtils.java +++ b/opengl/java/android/opengl/GLUtils.java @@ -16,9 +16,11 @@ package android.opengl; -import javax.microedition.khronos.opengles.GL10; import android.graphics.Bitmap; +import javax.microedition.khronos.egl.EGL10; +import javax.microedition.khronos.egl.EGL11; + /** * * Utility class to help bridging OpenGL ES and Android APIs. @@ -222,6 +224,51 @@ public final class GLUtils { } } + /** + * Return a string for the EGL error code, or the hex representation + * if the error is unknown. + * + * @param error The EGL error to convert into a String. + * + * @return An error string corresponding to the EGL error code. + */ + public static String getEGLErrorString(int error) { + switch (error) { + case EGL10.EGL_SUCCESS: + return "EGL_SUCCESS"; + case EGL10.EGL_NOT_INITIALIZED: + return "EGL_NOT_INITIALIZED"; + case EGL10.EGL_BAD_ACCESS: + return "EGL_BAD_ACCESS"; + case EGL10.EGL_BAD_ALLOC: + return "EGL_BAD_ALLOC"; + case EGL10.EGL_BAD_ATTRIBUTE: + return "EGL_BAD_ATTRIBUTE"; + case EGL10.EGL_BAD_CONFIG: + return "EGL_BAD_CONFIG"; + case EGL10.EGL_BAD_CONTEXT: + return "EGL_BAD_CONTEXT"; + case EGL10.EGL_BAD_CURRENT_SURFACE: + return "EGL_BAD_CURRENT_SURFACE"; + case EGL10.EGL_BAD_DISPLAY: + return "EGL_BAD_DISPLAY"; + case EGL10.EGL_BAD_MATCH: + return "EGL_BAD_MATCH"; + case EGL10.EGL_BAD_NATIVE_PIXMAP: + return "EGL_BAD_NATIVE_PIXMAP"; + case EGL10.EGL_BAD_NATIVE_WINDOW: + return "EGL_BAD_NATIVE_WINDOW"; + case EGL10.EGL_BAD_PARAMETER: + return "EGL_BAD_PARAMETER"; + case EGL10.EGL_BAD_SURFACE: + return "EGL_BAD_SURFACE"; + case EGL11.EGL_CONTEXT_LOST: + return "EGL_CONTEXT_LOST"; + default: + return "0x" + Integer.toHexString(error); + } + } + native private static void nativeClassInit(); native private static int native_getInternalFormat(Bitmap bitmap); |