|
@@ -37,30 +37,29 @@ namespace crown
|
|
|
extern ANativeWindow* g_android_window;
|
|
extern ANativeWindow* g_android_window;
|
|
|
|
|
|
|
|
//-----------------------------------------------------------------------------
|
|
//-----------------------------------------------------------------------------
|
|
|
-static const char* egl_error_to_string(EGLint error)
|
|
|
|
|
-{
|
|
|
|
|
- switch (error)
|
|
|
|
|
|
|
+#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
|
|
|
|
|
+ static const char* egl_error_to_string(EGLint error)
|
|
|
{
|
|
{
|
|
|
- case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
|
|
|
|
|
- case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
|
|
|
|
|
- case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
|
|
|
|
|
- case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
|
|
|
|
|
- case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
|
|
|
|
|
- case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
|
|
|
|
|
- case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
|
|
|
|
|
- case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
|
|
|
|
|
- case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
|
|
|
|
|
- case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
|
|
|
|
|
- case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
|
|
|
|
|
- case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
|
|
|
|
|
- case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
|
|
|
|
|
- case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
|
|
|
|
|
- default: return "UNKNOWN_EGL_ERROR";
|
|
|
|
|
|
|
+ switch (error)
|
|
|
|
|
+ {
|
|
|
|
|
+ case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED";
|
|
|
|
|
+ case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS";
|
|
|
|
|
+ case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC";
|
|
|
|
|
+ case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE";
|
|
|
|
|
+ case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT";
|
|
|
|
|
+ case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG";
|
|
|
|
|
+ case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE";
|
|
|
|
|
+ case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY";
|
|
|
|
|
+ case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE";
|
|
|
|
|
+ case EGL_BAD_MATCH: return "EGL_BAD_MATCH";
|
|
|
|
|
+ case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER";
|
|
|
|
|
+ case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP";
|
|
|
|
|
+ case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW";
|
|
|
|
|
+ case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST";
|
|
|
|
|
+ default: return "UNKNOWN_EGL_ERROR";
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
-}
|
|
|
|
|
|
|
|
|
|
-//-----------------------------------------------------------------------------
|
|
|
|
|
-#if defined(CROWN_DEBUG) || defined(CROWN_DEVELOPMENT)
|
|
|
|
|
#define EGL_CHECK(function)\
|
|
#define EGL_CHECK(function)\
|
|
|
function;\
|
|
function;\
|
|
|
do { EGLint error; CE_ASSERT((error = eglGetError()) == EGL_SUCCESS,\
|
|
do { EGLint error; CE_ASSERT((error = eglGetError()) == EGL_SUCCESS,\
|
|
@@ -95,14 +94,17 @@ void GLContext::create_context()
|
|
|
EGLint egl_major, egl_minor;
|
|
EGLint egl_major, egl_minor;
|
|
|
EGLBoolean init_success = EGL_CHECK(eglInitialize(display, &egl_major, &egl_minor));
|
|
EGLBoolean init_success = EGL_CHECK(eglInitialize(display, &egl_major, &egl_minor));
|
|
|
CE_ASSERT(init_success == EGL_TRUE, "Failed to initialize EGL");
|
|
CE_ASSERT(init_success == EGL_TRUE, "Failed to initialize EGL");
|
|
|
|
|
+ CE_UNUSED(init_success);
|
|
|
|
|
|
|
|
CE_LOGD("EGL Initialized: major = %d, minor = %d", egl_major, egl_minor);
|
|
CE_LOGD("EGL Initialized: major = %d, minor = %d", egl_major, egl_minor);
|
|
|
|
|
|
|
|
EGLBoolean bind_success = EGL_CHECK(eglBindAPI(EGL_OPENGL_ES_API));
|
|
EGLBoolean bind_success = EGL_CHECK(eglBindAPI(EGL_OPENGL_ES_API));
|
|
|
CE_ASSERT(bind_success != EGL_FALSE, "Failed to bind OpenGL|ES API");
|
|
CE_ASSERT(bind_success != EGL_FALSE, "Failed to bind OpenGL|ES API");
|
|
|
|
|
+ CE_UNUSED(bind_success);
|
|
|
|
|
|
|
|
EGLBoolean cfg_success = EGL_CHECK(eglChooseConfig(display, attrib_list, &config, 1, &num_configs));
|
|
EGLBoolean cfg_success = EGL_CHECK(eglChooseConfig(display, attrib_list, &config, 1, &num_configs));
|
|
|
CE_ASSERT(cfg_success == EGL_TRUE, "Failed to choose EGL configuration");
|
|
CE_ASSERT(cfg_success == EGL_TRUE, "Failed to choose EGL configuration");
|
|
|
|
|
+ CE_UNUSED(cfg_success);
|
|
|
|
|
|
|
|
EGLint format;
|
|
EGLint format;
|
|
|
EGL_CHECK(eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format));
|
|
EGL_CHECK(eglGetConfigAttrib(display, config, EGL_NATIVE_VISUAL_ID, &format));
|