Code example for EGL10

Methods: eglGetError, eglMakeCurrent

0
			} 
 
			/* 
			 * Create an EGL surface we can render into. 
			 */ 
			m_surface = EGLSurfaceFactory.createSurface( m_egl, m_config, EGLManager.getDisplay( ), holder);
			if( m_surface == null || m_surface == EGL10.EGL_NO_SURFACE || m_egl.eglGetError( ) != EGL10.EGL_SUCCESS )
			{ 
				Log.i( "EGLView", "Failed to create surface. EGL Error: " + m_egl.eglGetError( ) );
				m_surfaceLock.unlock( );
				throw new RuntimeException( "Failed to create surface." );
			} 
 
			setSurfaceCurrent( false ); 
 
			m_surfaceLock.unlock( );
		} 
 
		/** 
		 * Detaches the current surface from the context, 
		 * and destroys the surface. 
		 */ 
		public void destroySurface() 
		{ 
			m_surfaceLock.lock( );
 
			m_egl.eglMakeCurrent( EGLManager.getDisplay( ), EGL10.EGL_NO_SURFACE,
					EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT );
			EGLSurfaceFactory.destroySurface( m_egl, EGLManager.getDisplay( ),
					m_surface );
			m_surface = null;
			setSurfaceCurrent( false ); 
 
			m_surfaceLock.unlock( );