Have our EGL interface use our logging functions.

This commit is contained in:
Ryan Houdek 2013-04-23 14:17:16 -05:00
parent c2e0b9e070
commit f28efc24eb

View File

@ -71,14 +71,14 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_dpy = Platform.EGLGetDisplay(); GLWin.egl_dpy = Platform.EGLGetDisplay();
if (!GLWin.egl_dpy) { if (!GLWin.egl_dpy) {
printf("Error: eglGetDisplay() failed\n"); INFO_LOG(VIDEO, "Error: eglGetDisplay() failed\n");
return false; return false;
} }
GLWin.platform = Platform.platform; GLWin.platform = Platform.platform;
if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) { if (!eglInitialize(GLWin.egl_dpy, &egl_major, &egl_minor)) {
printf("Error: eglInitialize() failed\n"); INFO_LOG(VIDEO, "Error: eglInitialize() failed\n");
return false; return false;
} }
@ -89,7 +89,7 @@ bool cInterfaceEGL::Create(void *&window_handle)
#endif #endif
if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) { if (!eglChooseConfig( GLWin.egl_dpy, attribs, &config, 1, &num_configs)) {
printf("Error: couldn't get an EGL visual config\n"); INFO_LOG(VIDEO, "Error: couldn't get an EGL visual config\n");
exit(1); exit(1);
} }
@ -97,20 +97,20 @@ bool cInterfaceEGL::Create(void *&window_handle)
return false; return false;
s = eglQueryString(GLWin.egl_dpy, EGL_VERSION); s = eglQueryString(GLWin.egl_dpy, EGL_VERSION);
printf("EGL_VERSION = %s\n", s); INFO_LOG(VIDEO, "EGL_VERSION = %s\n", s);
s = eglQueryString(GLWin.egl_dpy, EGL_VENDOR); s = eglQueryString(GLWin.egl_dpy, EGL_VENDOR);
printf("EGL_VENDOR = %s\n", s); INFO_LOG(VIDEO, "EGL_VENDOR = %s\n", s);
s = eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS); s = eglQueryString(GLWin.egl_dpy, EGL_EXTENSIONS);
printf("EGL_EXTENSIONS = %s\n", s); INFO_LOG(VIDEO, "EGL_EXTENSIONS = %s\n", s);
s = eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS); s = eglQueryString(GLWin.egl_dpy, EGL_CLIENT_APIS);
printf("EGL_CLIENT_APIS = %s\n", s); INFO_LOG(VIDEO, "EGL_CLIENT_APIS = %s\n", s);
GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs ); GLWin.egl_ctx = eglCreateContext(GLWin.egl_dpy, config, EGL_NO_CONTEXT, ctx_attribs );
if (!GLWin.egl_ctx) { if (!GLWin.egl_ctx) {
printf("Error: eglCreateContext failed\n"); INFO_LOG(VIDEO, "Error: eglCreateContext failed\n");
exit(1); exit(1);
} }
@ -119,20 +119,20 @@ bool cInterfaceEGL::Create(void *&window_handle)
GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config, GLWin.egl_surf = eglCreateWindowSurface(GLWin.egl_dpy, config,
GLWin.native_window, NULL); GLWin.native_window, NULL);
if (!GLWin.egl_surf) { if (!GLWin.egl_surf) {
printf("Error: eglCreateWindowSurface failed\n"); INFO_LOG(VIDEO, "Error: eglCreateWindowSurface failed\n");
exit(1); exit(1);
} }
if (!eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx)) { if (!eglMakeCurrent(GLWin.egl_dpy, GLWin.egl_surf, GLWin.egl_surf, GLWin.egl_ctx)) {
printf("Error: eglMakeCurrent() failed\n"); INFO_LOG(VIDEO, "Error: eglMakeCurrent() failed\n");
return false; return false;
} }
printf("GL_VENDOR: %s\n", glGetString(GL_VENDOR)); INFO_LOG(VIDEO, "GL_VENDOR: %s\n", glGetString(GL_VENDOR));
printf("GL_RENDERER: %s\n", glGetString(GL_RENDERER)); INFO_LOG(VIDEO, "GL_RENDERER: %s\n", glGetString(GL_RENDERER));
printf("GL_VERSION: %s\n", glGetString(GL_VERSION)); INFO_LOG(VIDEO, "GL_VERSION: %s\n", glGetString(GL_VERSION));
printf("GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS)); INFO_LOG(VIDEO, "GL_EXTENSIONS: %s\n", glGetString(GL_EXTENSIONS));
Platform.ToggleFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen); Platform.ToggleFullscreen(SConfig::GetInstance().m_LocalCoreStartupParameter.bFullscreen);
@ -152,9 +152,13 @@ void cInterfaceEGL::Shutdown()
NOTICE_LOG(VIDEO, "Could not release drawing context."); NOTICE_LOG(VIDEO, "Could not release drawing context.");
if (GLWin.egl_ctx) if (GLWin.egl_ctx)
{ {
eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx); eglMakeCurrent(GLWin.egl_dpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf); if(!eglDestroyContext(GLWin.egl_dpy, GLWin.egl_ctx))
eglTerminate(GLWin.egl_dpy); NOTICE_LOG(VIDEO, "Could not destroy drawing context.");
if(!eglDestroySurface(GLWin.egl_dpy, GLWin.egl_surf))
NOTICE_LOG(VIDEO, "Could not destroy window surface.");
if(!eglTerminate(GLWin.egl_dpy))
NOTICE_LOG(VIDEO, "Could not destroy display connection.");
GLWin.egl_ctx = NULL; GLWin.egl_ctx = NULL;
} }
} }