Code example for EGL10

Methods: eglCreateWindowSurfaceeglDestroySurfaceeglMakeCurrent

	public GL createSurface(final SurfaceHolder pSurfaceHolder) {
		/* The window size has changed, so we need to create a new surface. */ 
		if (this.mEGLSurface != null && this.mEGLSurface != EGL10.EGL_NO_SURFACE) {
			/* Unbind and destroy the old EGL surface, if there is one. */ 
			this.mEGL.eglMakeCurrent(this.mEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
			this.mEGL.eglDestroySurface(this.mEGLDisplay, this.mEGLSurface);
		/* Create an EGL surface we can render into. */ 
		this.mEGLSurface = this.mEGL.eglCreateWindowSurface(this.mEGLDisplay, this.mEGLConfig, pSurfaceHolder, null);
		if (this.mEGLSurface == null || this.mEGLSurface == EGL10.EGL_NO_SURFACE) {
			throw new RuntimeException("createSurface failed");
		/* Before we can issue GL commands, we need to make sure the context is current and bound to a surface. */ 
		if (!this.mEGL.eglMakeCurrent(this.mEGLDisplay, this.mEGLSurface, this.mEGLSurface, this.mEGLContext)) {
			throw new RuntimeException("eglMakeCurrent failed.");
		return this.mEGLContext.getGL();
Connect your IDE to all the code out there  Get Codota for Java