CTSmallWindowOpenVG::~CTSmallWindowOpenVG()
	{
	// Make sure that this egl status is active
	eglMakeCurrent(iDisplay, iSurface, iSurface, iContextVG);
    vgDestroyPaint(iFillPaint);
    vgDestroyPaint(iStrokePaint);
    vgDestroyPath(iPath);
	if (iContextVG != EGL_NO_CONTEXT)
		{
		eglDestroyContext(iDisplay,iContextVG);
		}
	if (iSurface != EGL_NO_SURFACE)
		{
		eglDestroySurface(iDisplay,iSurface);
		}	
	// Call eglMakeCurrent() to ensure the surfaces and contexts are truly destroyed. 
	eglMakeCurrent(iDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
	//eglTerminate(iDisplay);
	eglReleaseThread();
	}
void CEGLGraphicsInterface::Terminate()
    {
    if (iEglDisplay != EGL_NO_DISPLAY)
        {
        eglMakeCurrent(iEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
        if (iEglContext)
            {
            eglDestroyContext(iEglDisplay, iEglContext);
            iEglContext = EGL_NO_CONTEXT;
            }
        if (iEglSurface)
            {
            eglDestroySurface(iEglDisplay, iEglSurface);
            iEglSurface = EGL_NO_SURFACE;
            }
        eglTerminate(iEglDisplay);
        eglReleaseThread();
        iEglDisplay = EGL_NO_DISPLAY;
        }
    }
Beispiel #3
0
// -----------------------------------------------------------------------------
// CGameController::~CGameController
// Destructor.
// -----------------------------------------------------------------------------
//
CGameController::~CGameController()
{
    // EGL related cleanup.
    eglMakeCurrent( iEglDisplay, EGL_NO_SURFACE, 
                    EGL_NO_SURFACE, EGL_NO_CONTEXT 
                  );
    eglDestroySurface( iEglDisplay, iEglSurface );
    eglDestroyContext( iEglDisplay, iEglContext );
    
    // Destroy the RWindow.
    if( iWindow != NULL )
    {
        iWindow->SetOrdinalPosition( KOrdinalPositionSwitchToOwningWindow );
        iWindow->Close();
        delete iWindow;
        iWindow = NULL;
    }
    
    delete iWsEventReceiver;
}
Beispiel #4
0
void OpenGLES_DestroyContext()
{
  if (EGL_NO_CONTEXT != es_context.eglContext)
  {
     eglDestroyContext(es_context.eglDisplay, es_context.eglContext);
     es_context.eglContext = EGL_NO_CONTEXT;
  }

  if (EGL_NO_SURFACE != es_context.eglSurface)
  {
     eglDestroySurface(es_context.eglDisplay, es_context.eglSurface);
     es_context.eglSurface = EGL_NO_SURFACE;
  }

  if (EGL_NO_DISPLAY != es_context.eglDisplay)
  {
     eglTerminate(es_context.eglDisplay);
     es_context.eglDisplay = EGL_NO_DISPLAY;
  }
}
Beispiel #5
0
void kill_GLES2() {
	if (egl_disp != EGL_NO_DISPLAY) {
		eglMakeCurrent(egl_disp, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
		if (egl_surf != EGL_NO_SURFACE) {
			eglDestroySurface(egl_disp, egl_surf);
			egl_surf = EGL_NO_SURFACE;
		}
		if (egl_ctx != EGL_NO_CONTEXT) {
			eglDestroyContext(egl_disp, egl_ctx);
			egl_ctx = EGL_NO_CONTEXT;
		}
		if (screen_win != NULL) {
			screen_destroy_window(screen_win);
			screen_win = NULL;
		}
		eglTerminate(egl_disp);
		egl_disp = EGL_NO_DISPLAY;
	}
	eglReleaseThread();
}
Beispiel #6
0
static void exit_func(void)
// Function to be passed to atexit().
{
   // clear screen
   glClear( GL_COLOR_BUFFER_BIT );
   eglSwapBuffers(state->display, state->surface);

   // Release OpenGL resources
   eglMakeCurrent( state->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
   eglDestroySurface( state->display, state->surface );
   eglDestroyContext( state->display, state->context );
   eglTerminate( state->display );

   // release texture buffers
   free(state->tex_buf1);
   free(state->tex_buf2);
   free(state->tex_buf3);

   printf("\ncube closed\n");
} // exit_func()
void OpenGL::Teardown()
{
	if (eglDisplay != EGL_NO_DISPLAY) 
	{
		eglMakeCurrent( eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
		if ( eglContext != EGL_NO_CONTEXT) 
		{
			eglDestroyContext(eglDisplay, eglContext);
		}
		if ( eglSurface != EGL_NO_SURFACE) 
		{
			eglDestroySurface(eglDisplay, eglSurface);
		}
		eglTerminate(eglDisplay);
	}

	eglDisplay = EGL_NO_DISPLAY;
	eglContext = EGL_NO_CONTEXT;
	eglSurface = EGL_NO_SURFACE;
}
Beispiel #8
0
void engine_term_display(void)
{
	if(display!=EGL_NO_DISPLAY)
	{
		eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

		if(context!=EGL_NO_CONTEXT)
			eglDestroyContext(display, context);

		if(surface!=EGL_NO_SURFACE)
			eglDestroySurface(display, surface);

		eglTerminate(display);

	}

	display=EGL_NO_DISPLAY;
    context=EGL_NO_CONTEXT;
    surface=EGL_NO_SURFACE;
}
Beispiel #9
0
void pi_deinit(void) {
    gles2_destroy();
    // Release OpenGL resources
    eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    eglDestroySurface(display, surface);
    eglDestroyContext(display, context);
    eglTerminate(display);

    dispman_update = vc_dispmanx_update_start(0);
    vc_dispmanx_element_remove(dispman_update, dispman_element);
    vc_dispmanx_element_remove(dispman_update, dispman_element_bg);
    vc_dispmanx_update_submit_sync(dispman_update);
    vc_dispmanx_resource_delete(resource0);
    vc_dispmanx_resource_delete(resource1);
    vc_dispmanx_resource_delete(resource_bg);
    vc_dispmanx_display_close(dispman_display);

    if (VideoBuffer) free(VideoBuffer);
    VideoBuffer = 0;
}
Beispiel #10
0
void GAPI_ReleaseOGL_ES(GAPIPriv *ctx, Bool offscreen_only)
{
	if (ctx->egldpy) {
		eglMakeCurrent(ctx->egldpy, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

		if (ctx->eglctx) eglDestroyContext(ctx->egldpy, ctx->eglctx);
		ctx->eglctx = 0;
		if (ctx->surface) eglDestroySurface(ctx->egldpy, ctx->surface);
		ctx->surface = 0;
		if (ctx->egldpy) eglTerminate(ctx->egldpy);
		ctx->egldpy = 0;
	}
    if (ctx->gl_bitmap) DeleteObject(ctx->gl_bitmap);
	ctx->gl_bitmap = NULL;

	if (offscreen_only) return;

    if (ctx->bitmap) DeleteObject(ctx->bitmap);
	ctx->bitmap = NULL;
}
static void
gst_gl_context_egl_destroy_context (GstGLContext * context)
{
  GstGLContextEGL *egl;

  egl = GST_GL_CONTEXT_EGL (context);

  gst_gl_context_egl_activate (context, FALSE);

  if (egl->egl_surface)
    eglDestroySurface (egl->egl_surface, egl->egl_display);

  if (egl->egl_context)
    eglDestroyContext (egl->egl_display, egl->egl_context);

  if (egl->egl_display) {
    eglTerminate (egl->egl_display);
    eglReleaseThread ();
  }
}
WaylandEGLContext::~WaylandEGLContext ()
{
    if (subsurface)
        wl_subsurface_destroy (subsurface);

    if (region)
        wl_region_destroy (region);

    if (child)
        wl_surface_destroy (child);

    if (egl_context)
        eglDestroyContext (egl_display, egl_context);

    if (egl_surface)
        eglDestroySurface (egl_display, egl_surface);

    if (egl_window)
        wl_egl_window_destroy (egl_window);
}
TEST_F(EGLCreateContextTest, BadAttributeFails) {
    // First check that we can successfully create a context
    EGLint attribs[5] = {
        EGL_CONTEXT_CLIENT_VERSION, 2,
        EGL_NONE, EGL_NONE, EGL_NONE,
    };
    mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT,
            attribs);
    ASSERT_NE(mEglContext, EGL_NO_CONTEXT);
    ASSERT_EQ(eglGetError(), EGL_SUCCESS);
    ASSERT_EQ(EGL_TRUE, eglDestroyContext(mEglDisplay, mEglContext));
    mEglContext = EGL_NO_CONTEXT;

    // Now add an invalid attribute and make sure eglCreateContext fails
    attribs[2] = EGL_BAD_ATTRIBUTE; // error code, not a valid attribute
    mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT,
            attribs);
    ASSERT_EQ(mEglContext, EGL_NO_CONTEXT);
    ASSERT_EQ(eglGetError(), EGL_BAD_ATTRIBUTE);
}
gboolean gst_imx_egl_viv_sink_egl_platform_shutdown_window(GstImxEglVivSinkEGLPlatform *platform)
{
	Display *x11_display = (Display *)(platform->native_display);
	Window x11_window = (Window)(platform->native_window);

	if (platform->native_window == 0)
		return TRUE;

	eglMakeCurrent(platform->egl_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);

	if (platform->egl_context != EGL_NO_CONTEXT)
		eglDestroyContext(platform->egl_display, platform->egl_context);

	if (platform->egl_surface != EGL_NO_SURFACE)
		eglDestroySurface(platform->egl_display, platform->egl_surface);

	if (platform->egl_display != EGL_NO_DISPLAY)
		eglTerminate(platform->egl_display);

	platform->egl_display = EGL_NO_DISPLAY;
	platform->egl_context = EGL_NO_CONTEXT;
	platform->egl_surface = EGL_NO_SURFACE;

	EGL_PLATFORM_LOCK(platform);

	XSelectInput(x11_display, x11_window, 0);

	while (XPending(x11_display))
	{
		XEvent xevent;
		XNextEvent(x11_display, &xevent);
	}

	XDestroyWindow(x11_display, x11_window);

	platform->native_window = 0;

	EGL_PLATFORM_UNLOCK(platform);

	return TRUE;
}
Beispiel #15
0
static void
close_ogl (void)
{
#if defined (USE_OMX_TARGET_RPI)
    DISPMANX_UPDATE_HANDLE_T dispman_update;
#endif

    if (state->fshader) {
        glDeleteShader (state->fshader);
        glDetachShader (state->program, state->fshader);
    }

    if (state->vshader) {
        glDeleteShader (state->vshader);
        glDetachShader (state->program, state->vshader);
    }

    if (state->program)
        glDeleteProgram (state->program);

    if (state->tex)
        glDeleteTextures (1, &state->tex);

    /* clear screen */
    glClear (GL_COLOR_BUFFER_BIT);
    eglSwapBuffers (state->display, state->surface);

    /* Release OpenGL resources */
    eglMakeCurrent (state->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                    EGL_NO_CONTEXT);
    eglDestroySurface (state->display, state->surface);
    eglDestroyContext (state->display, state->context);
    gst_object_unref (state->gst_display);

#if defined (USE_OMX_TARGET_RPI)
    dispman_update = vc_dispmanx_update_start (0);
    vc_dispmanx_element_remove (dispman_update, state->dispman_element);
    vc_dispmanx_update_submit_sync (dispman_update);
    vc_dispmanx_display_close (state->dispman_display);
#endif
}
void
CAndroidGLESWindowContext::Shutdown( void )
{GUCEF_TRACE;

    if ( m_display != EGL_NO_DISPLAY )
    {
        eglMakeCurrent( m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
        if ( m_context != EGL_NO_CONTEXT )
        {
            eglDestroyContext( m_display, m_context );
        }
        if ( m_surface != EGL_NO_SURFACE )
        {
            eglDestroySurface( m_display, m_surface );
        }
        eglTerminate( m_display );
    }
    m_display = EGL_NO_DISPLAY;
    m_context = EGL_NO_CONTEXT;
    m_surface = EGL_NO_SURFACE;
}
void OpenGLRenderForm::DestroyEGL() {

	AppLog("OpenGLRenderForm::DestroyEGL()");

    if (eDisplay) {
        eglMakeCurrent(eDisplay, null, null, null);

        if (eContext) {
            eglDestroyContext(eDisplay, eContext);
            eContext = EGL_NO_CONTEXT;
        }

        if (eSurface) {
            eglDestroySurface(eDisplay, eSurface);
            eSurface = EGL_NO_SURFACE;
        }

        eglTerminate(eDisplay);
        eDisplay = EGL_NO_DISPLAY;
    }
}
Beispiel #18
0
static void
clutter_backend_egl_dispose (GObject *gobject)
{
    ClutterBackendEGL *backend_egl = CLUTTER_BACKEND_EGL (gobject);

    _clutter_events_uninit (CLUTTER_BACKEND (backend_egl));

    if (backend_egl->egl_context)
    {
        eglDestroyContext (backend_egl->edpy, backend_egl->egl_context);
        backend_egl->egl_context = NULL;
    }

    if (backend_egl->edpy)
    {
        eglTerminate (backend_egl->edpy);
        backend_egl->edpy = 0;
    }

    G_OBJECT_CLASS (clutter_backend_egl_parent_class)->dispose (gobject);
}
Beispiel #19
0
static void     _egl_done       (s52engine *engine)
// Tear down the EGL context currently associated with the display.
{
    if (engine->eglDisplay != EGL_NO_DISPLAY) {
        eglMakeCurrent(engine->eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
        if (engine->eglContext != EGL_NO_CONTEXT) {
            eglDestroyContext(engine->eglDisplay, engine->eglContext);
        }
        if (engine->eglSurface != EGL_NO_SURFACE) {
            eglDestroySurface(engine->eglDisplay, engine->eglSurface);
        }
        eglTerminate(engine->eglDisplay);
    }

    //engine->animating  = 0;
    engine->eglDisplay = EGL_NO_DISPLAY;
    engine->eglContext = EGL_NO_CONTEXT;
    engine->eglSurface = EGL_NO_SURFACE;

    return;
}
Beispiel #20
0
// EGL情報を破棄する
static void engine_term_display(struct engine* engine) {
    if (engine->display != EGL_NO_DISPLAY) {
        // EGLレンダリングコンテキストとEGLサーフェイスの関連を外す
        eglMakeCurrent(engine->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
                       EGL_NO_CONTEXT);
        // EGLレンダリングコンテキストを破棄する
        if (engine->context != EGL_NO_CONTEXT)
            eglDestroyContext(engine->display, engine->context);
        // EGLサーフェイスを破棄する
        if (engine->surface != EGL_NO_SURFACE)
            eglDestroySurface(engine->display, engine->surface);
        // EGLディスプレイを破棄する
        eglTerminate(engine->display);
    }
    // アニメーション停止
    engine->animating = 0;
    // EGL関連データを破棄
    engine->display = EGL_NO_DISPLAY;
    engine->context = EGL_NO_CONTEXT;
    engine->surface = EGL_NO_SURFACE;
}
bool BootAnimation::threadLoop()
{
    bool r;
    if (mAndroidAnimation) {
        r = android();
    } else {
        r = movie();
    }

    // No need to force exit anymore
    property_set(EXIT_PROP_NAME, "0");

    eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    eglDestroyContext(mDisplay, mContext);
    eglDestroySurface(mDisplay, mSurface);
    mFlingerSurface.clear();
    mFlingerSurfaceControl.clear();
    eglTerminate(mDisplay);
    IPCThreadState::self()->stopProcess();
    return r;
}
Beispiel #22
0
void Renderer::Destroy()
{
	m_initialized = false;

	if (m_display != EGL_NO_DISPLAY)
	{
		eglMakeCurrent(m_display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
		if (m_context != EGL_NO_CONTEXT)
		{
			eglDestroyContext(m_display, m_context);
		}
		if (m_surface != EGL_NO_SURFACE)
		{
			eglDestroySurface(m_display, m_surface);
		}
		eglTerminate(m_display);
	}
	m_display = EGL_NO_DISPLAY;
	m_context = EGL_NO_CONTEXT;
	m_surface = EGL_NO_SURFACE;
}
Beispiel #23
0
void microgl_close()
{
#ifdef USE_GLX
  glXMakeCurrent( Dpy, None, NULL );
  glXDestroyContext( Dpy, win.CX );
#endif
#ifdef USE_EGL
  eglDestroyContext(win.egl_display, win.egl_context);
  eglDestroySurface(win.egl_display, win.egl_surface);
  eglTerminate(win.egl_display);
#endif
  if (win.KeyboardGrabbed) {
    XUngrabKeyboard(Dpy,CurrentTime);
  } 
  if (win.PointerGrabbed) {
    XUngrabPointer(Dpy, CurrentTime);
  }
  XUnmapWindow( Dpy, win.Win );
  XDestroyWindow( Dpy, win.Win );
  XCloseDisplay(Dpy);
}
Beispiel #24
0
void EGL_Close() {
	if (g_eglDisplay != NULL) {
		eglMakeCurrent(g_eglDisplay, NULL, NULL, EGL_NO_CONTEXT);
		if (g_eglContext != NULL) {
			eglDestroyContext(g_eglDisplay, g_eglContext);
		}
		if (g_eglSurface != NULL) {
			eglDestroySurface(g_eglDisplay, g_eglSurface);
		}
		eglTerminate(g_eglDisplay);
		g_eglDisplay = NULL;
	}
	if (g_Display != NULL) {
#if !defined(USING_FBDEV)
		XCloseDisplay(g_Display);
#endif
		g_Display = NULL;
	}
	g_eglSurface = NULL;
	g_eglContext = NULL;
}
Beispiel #25
0
static void exit_func(void)
// Function to be passed to atexit().
{
   if (eglImage != 0)
   {
      if (!eglDestroyImageKHR(state->display, (EGLImageKHR) eglImage))
         printf("eglDestroyImageKHR failed.");
   }

   // clear screen
   glClear( GL_COLOR_BUFFER_BIT );
   eglSwapBuffers(state->display, state->surface);

   // Release OpenGL resources
   eglMakeCurrent( state->display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT );
   eglDestroySurface( state->display, state->surface );
   eglDestroyContext( state->display, state->context );
   eglTerminate( state->display );

   printf("\ncube closed\n");
} // exit_func()
Beispiel #26
0
static void
close_ogl (void)
{
  DISPMANX_UPDATE_HANDLE_T dispman_update;

  /* clear screen */
  glClear (GL_COLOR_BUFFER_BIT);
  eglSwapBuffers (state->display, state->surface);

  /* Release OpenGL resources */
  eglMakeCurrent (state->display, EGL_NO_SURFACE, EGL_NO_SURFACE,
      EGL_NO_CONTEXT);
  eglDestroySurface (state->display, state->surface);
  eglDestroyContext (state->display, state->context);
  gst_egl_display_unref (state->gst_display);

  dispman_update = vc_dispmanx_update_start (0);
  vc_dispmanx_element_remove (dispman_update, state->dispman_element);
  vc_dispmanx_update_submit_sync (dispman_update);
  vc_dispmanx_display_close (state->dispman_display);
}
Beispiel #27
0
void CGLContextEGL::Destroy()
{
  if (m_eglContext != EGL_NO_CONTEXT)
  {
    eglDestroyContext(m_eglDisplay, m_eglContext);
    eglMakeCurrent(m_eglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    m_eglContext = EGL_NO_CONTEXT;
  }

  if (m_eglSurface != EGL_NO_SURFACE)
  {
    eglDestroySurface(m_eglDisplay, m_eglSurface);
    m_eglSurface = EGL_NO_SURFACE;
  }

  if (m_eglDisplay != EGL_NO_DISPLAY)
  {
    eglTerminate(m_eglDisplay);
    m_eglDisplay = EGL_NO_DISPLAY;
  }
}
Beispiel #28
0
int deinit_gl(EGLDisplay display, EGLContext context, EGLSurface surface) {
	if(eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT) == EGL_FALSE)
		return 0;
	check();

	if(eglDestroySurface(display, surface) == EGL_FALSE)
		return 0;
	check();
	
	if(eglDestroyContext(display, context) == EGL_FALSE)
		return 0;
	check();

	if(eglTerminate(display) == EGL_FALSE)
		return 0;
	check();

	bcm_host_deinit();

	return 1;
}
Beispiel #29
0
GLContextEGL::~GLContextEGL()
{
#if USE(CAIRO)
    if (m_cairoDevice)
        cairo_device_destroy(m_cairoDevice);
#endif

    EGLDisplay display = m_display.eglDisplay();
    if (m_context) {
        glBindFramebuffer(GL_FRAMEBUFFER, 0);
        eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
        eglDestroyContext(display, m_context);
    }

    if (m_surface)
        eglDestroySurface(display, m_surface);

#if PLATFORM(WAYLAND)
    destroyWaylandWindow();
#endif
}
Beispiel #30
0
void video_egl_shutdown()
{
    if( fbo_created ) {
        pvr2_shutdown_gl_context();
        gl_fbo_shutdown();
        fbo_created = FALSE;
    }
    eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
    if( surface != EGL_NO_SURFACE )  {
        eglDestroySurface(display, surface);
        surface = EGL_NO_SURFACE;
    }
    if( context != EGL_NO_CONTEXT ) {
        eglDestroyContext(display, context);
        context = EGL_NO_CONTEXT;
    }
    if( display != EGL_NO_DISPLAY ) {
        eglTerminate(display);
        display = EGL_NO_DISPLAY;
    }
}