def _platform_free(self): """Frees resources associated with this context.""" if self._context: current_context = EGL.eglGetCurrentContext() if current_context and self._context.address == current_context.address: EGL.eglMakeCurrent(EGL_DISPLAY, EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, EGL.EGL_NO_CONTEXT) EGL.eglDestroyContext(EGL_DISPLAY, self._context) self._context = None
def _platform_make_current(self): if self._context: success = EGL.eglMakeCurrent( EGL_DISPLAY, EGL.EGL_NO_SURFACE, EGL.EGL_NO_SURFACE, self._context) if not success: raise RuntimeError('Failed to make the EGL context current.')