Esempio n. 1
0
/** @brief Release all EGL and system resources
 */
void EGL_Close( void )
{
    /* Release EGL resources */
    if (eglDisplay != NULL)
    {
        peglMakeCurrent( eglDisplay, NULL, NULL, EGL_NO_CONTEXT );
        if (eglContext != NULL) {
            peglDestroyContext( eglDisplay, eglContext );
        }
        if (eglSurface != NULL) {
            peglDestroySurface( eglDisplay, eglSurface );
        }
        peglTerminate( eglDisplay );
    }

    eglSurface = NULL;
    eglContext = NULL;
    eglDisplay = NULL;
	
	eglColorbits = 0;
	eglDepthbits = 0;
	eglStencilbits = 0;

    /* Release platform resources */
    FreeNativeWindow();
    FreeNativeDisplay();
    Platform_Close();

    CheckEGLErrors( __FILE__, __LINE__ );

    printf( "EGLport: Closed\n" );
}
/*======================================================
 * Close EGL resources
  ====================================================*/
void EGL_Close()
{
    if (g_eglDisplay != NULL)
    {
        peglMakeCurrent( g_eglDisplay, NULL, NULL, EGL_NO_CONTEXT );
        if (g_eglContext != NULL) {
            peglDestroyContext( g_eglDisplay, g_eglContext );
        }
        if (g_eglSurface != NULL) {
            peglDestroySurface( g_eglDisplay, g_eglSurface );
        }
        peglTerminate( g_eglDisplay );
    }

    g_eglSurface = NULL;
    g_eglContext = NULL;
    g_eglDisplay = NULL;

#if defined(USE_EGL_RAW)
    if (g_Window != NULL) {
        free(g_Window);
    }
    g_Window = NULL;
#elif defined(USE_EGL_SDL)
    if (g_Display != NULL) {
        XCloseDisplay(g_Display);
    }
    g_Display = NULL;
#else
    #error Incorrect EGL Configuration
#endif /* defined(USE_EGL_RAW) */

    CheckEGLErrors( __FILE__, __LINE__ );

    printf( "EGL Closed\n" );

    Platform_Close();
}