public void SurfaceDestroyed(ISurfaceHolder surfaceHolder) { mLoop.Set(false); this.Interrupt(); mSurfaceView.Holder.RemoveCallback(this); //MOVED SURFACE DESTROYING CODE TO FUNCTION CALLED WHEN APP IS PAUSED INSTEAD OF UNSTABLE CATCH UPON RETURN_______ if (mEGLDisplay != null) { EGL14.EglMakeCurrent(mEGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); if (mEGLSurface != null) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); } if (mEGLSurfaceMedia != null) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurfaceMedia); } EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); mSurfaceView.mHasGLContext.Set(false); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); mSurfaceView.mSurface.Release(); } //______________________________________________________________________________________________________________ }
/** * Makes our EGL context and surface current. */ public void makeCurrent() { if (!EGL14.EglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent failed"); } }
public int SurfaceHeight() { var heightArray = new int[1]; EGL14.EglQuerySurface(_eglDisplay, _eglSurface, 12374, heightArray, 0); return(heightArray[0]); }
public int SurfaceWidth() { var widthArray = new int[1]; EGL14.EglQuerySurface(_eglDisplay, _eglSurface, 12375, widthArray, 0); return(widthArray[0]); }
public void ReleaseSurface() { if (_eglSurface != EGL14.EglNoSurface) { EGL14.EglDestroySurface(_eglDisplay, _eglSurface); _eglSurface = EGL14.EglNoSurface; } }
EGLConfig chooseEglConfig(EGLDisplay eglDisplay) { int[] configsCount = new int[] { 0 }; EGLConfig[] configs = new EGLConfig[1]; EGL14.EglChooseConfig(eglDisplay, config, 0, configs, 0, configs.Length, configsCount, 0); return configs[0]; }
/** * Checks for EGL errors. */ private void checkEglError(String msg) { int error; if ((error = EGL14.EglGetError()) != EGL14.EglSuccess) { throw new RuntimeException(msg + ": EGL error: 0x" + Integer.ToHexString(error)); } }
public void DetachCurrent() { lock (EglBase.Lock) { if (!EGL14.EglMakeCurrent(_eglDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext)) { throw new RuntimeException("eglDetachCurrent failed: 0x" + Integer.ToHexString(EGL14.EglGetError())); } } }
private bool ElgInitialize() { prevEglContext = EGL14.EglGetCurrentContext(); prevEglDisplay = EGL14.EglGetCurrentDisplay(); prevEglSurfaceRead = EGL14.EglGetCurrentSurface(EGL14.EglRead); prevEglSurfaceDraw = EGL14.EglGetCurrentSurface(EGL14.EglDraw); eglDisplay = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay); if (eglDisplay == EGL14.EglNoDisplay) { return(false); } int[] version = new int[2]; if (!EGL14.EglInitialize(eglDisplay, version, 0, version, 1)) { return(false); } // Configure EGL for recording and OpenGL ES 2.0. int[] attribList = { EGL14.EglRedSize, 8, EGL14.EglGreenSize, 8, EGL14.EglBlueSize, 8, EGL14.EglAlphaSize, 8, EGL14.EglRenderableType, EGL14.EglOpenglEsBit, EGL_RECORDABLE_ANDROID, 1, EGL14.EglNone }; EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; EGL14.EglChooseConfig(eglDisplay, attribList, 0, configs, 0, configs.Length, numConfigs, 0); CheckEglError(); // Configure context for OpenGL ES 2.0. int[] attrib_list = { EGL14.EglContextClientVersion, 1, EGL14.EglNone }; eglContext = EGL14.EglCreateContext(eglDisplay, configs[0], EGL14.EglNoContext, attrib_list, 0); CheckEglError(); int[] surfaceAttribs = { EGL14.EglNone }; eglSurface = EGL14.EglCreateWindowSurface(eglDisplay, configs[0], surface, surfaceAttribs, 0); CheckEglError(); EGL14.EglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext); CheckEglError(); return(true); }
public void Release() { CheckIsNotReleased(); ReleaseSurface(); DetachCurrent(); EGL14.EglDestroyContext(_eglDisplay, _eglContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(_eglDisplay); _eglContext = EGL14.EglNoContext; _eglDisplay = EGL14.EglNoDisplay; _eglConfig = null; }
public void SwapBuffers() { CheckIsNotReleased(); if (_eglSurface == EGL14.EglNoSurface) { throw new RuntimeException("No EGLSurface - can't swap buffers"); } lock (EglBase.Lock) { EGL14.EglSwapBuffers(_eglDisplay, _eglSurface); } }
public void AddFrame(byte[] image) { Debug.WriteLine($"Sending frame {frameIndex} to encoder"); long presentationTime = ComputePresentationTimeNsec(frameIndex++); EGLExt.EglPresentationTimeANDROID(eglDisplay, eglSurface, presentationTime); CheckEglError(); EGL14.EglSwapBuffers(eglDisplay, eglSurface); CheckEglError(); DrainEncoder(videoEncoder, videoBufferInfo, videoTrackIndex, false); }
public void SwapBuffers(long timeStampNs) { CheckIsNotReleased(); if (_eglSurface == EGL14.EglNoSurface) { throw new RuntimeException("No EGLSurface - can't swap buffers"); } lock (EglBase.Lock) { EGLExt.EglPresentationTimeANDROID(_eglDisplay, _eglSurface, timeStampNs); EGL14.EglSwapBuffers(_eglDisplay, _eglSurface); } }
/** * Discards all resources held by this class, notably the EGL context. Also releases the * Surface that was passed to our constructor. */ public void release() { if (mEGLDisplay != EGL14.EglNoDisplay) { EGL14.EglMakeCurrent(mEGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EglNoDisplay; mEGLContext = EGL14.EglNoContext; mEGLSurface = EGL14.EglNoSurface; mSurface.Release(); }
/** * Checks for EGL errors. */ private void CheckEglError(string msg) { bool failed = false; int error; while ((error = EGL14.EglGetError()) != EGL14.EglSuccess) { Log.Error(TAG, msg + ": EGL error: 0x" + Integer.ToHexString(error)); failed = true; } if (failed) { throw new RuntimeException("EGL error encountered (see log)"); } }
public void CreatePbufferSurface(int width, int height) { CheckIsNotReleased(); if (_eglSurface != EGL14.EglNoSurface) { throw new RuntimeException("Already has an EGLSurface"); } var surfaceAttribs = new[] { 12375, width, 12374, height, 12344 }; _eglSurface = EGL14.EglCreatePbufferSurface(_eglDisplay, _eglConfig, surfaceAttribs, 0); if (_eglSurface == EGL14.EglNoSurface) { throw new RuntimeException("Failed to create pixel buffer surface with size " + width + "x" + height + ": 0x" + Integer.ToHexString(EGL14.EglGetError())); } }
private void CreateSurfaceInternal(Java.Lang.Object surface) { CheckIsNotReleased(); if (_eglSurface != EGL14.EglNoSurface) { throw new RuntimeException("Already has an EGLSurface"); } var surfaceAttribs = new[] { 12344 }; _eglSurface = EGL14.EglCreateWindowSurface(_eglDisplay, _eglConfig, surface, surfaceAttribs, 0); if (_eglSurface == EGL14.EglNoSurface) { throw new RuntimeException("Failed to create window surface: 0x" + Integer.ToHexString(EGL14.EglGetError())); } }
public void onSurfaceCreated(GL10 unused, EGLConfig config) { // if onSurfaceCreated is called while resuming from pause, // it means the GL context was lost paused.compareAndSet(1, -1); // assign high priority to the rendering thread java.lang.Thread.currentThread() .setPriority(java.lang.Thread.MAX_PRIORITY); // set swap interval if (swapInterval != 1) { var eglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); EGL14.eglSwapInterval(eglDisplay, swapInterval); } }
public void MakeCurrent() { CheckIsNotReleased(); if (_eglSurface == EGL14.EglNoSurface) { throw new RuntimeException("No EGLSurface - can't make current"); } lock (EglBase.Lock) { if (!EGL14.EglMakeCurrent(_eglDisplay, _eglSurface, _eglSurface, _eglContext)) { throw new RuntimeException("eglMakeCurrent failed: 0x" + Integer.ToHexString(EGL14.EglGetError())); } } }
private static EGLDisplay GetEglDisplay() { var eglDisplay = EGL14.EglGetDisplay(0); if (eglDisplay == EGL14.EglNoDisplay) { throw new RuntimeException("Unable to get EGL14 display: 0x" + Integer.ToHexString(EGL14.EglGetError())); } var version = new int[2]; if (!EGL14.EglInitialize(eglDisplay, version, 0, version, 1)) { throw new RuntimeException("Unable to initialize EGL14: 0x" + Integer.ToHexString(EGL14.EglGetError())); } return(eglDisplay); }
public void ElgShutdown() { if (eglDisplay != EGL14.EglNoDisplay) { EGL14.EglMakeCurrent(eglDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); EGL14.EglDestroySurface(eglDisplay, eglSurface); EGL14.EglDestroyContext(eglDisplay, eglContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(eglDisplay); } surface.Release(); eglDisplay = EGL14.EglNoDisplay; eglContext = EGL14.EglNoContext; eglSurface = EGL14.EglNoSurface; surface = null; EGL14.EglMakeCurrent(prevEglDisplay, prevEglSurfaceDraw, prevEglSurfaceRead, prevEglContext); }
/** * Discard all resources held by this class, notably the EGL context. Also releases the * Surface that was passed to our constructor. */ public void Release() { if (EGL14.EglGetCurrentContext().Equals(_EGLContext)) { // Clear the current context and surface to ensure they are discarded immediately. EGL14.EglMakeCurrent(_EGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); } EGL14.EglDestroySurface(_EGLDisplay, _EGLSurface); EGL14.EglDestroyContext(_EGLDisplay, _EGLContext); //EGL14.eglTerminate(mEGLDisplay); _surface.Release(); // null everything out so future attempts to use this object will cause an NPE _EGLDisplay = null; _EGLContext = null; _EGLSurface = null; _surface = null; }
/** * Discard all resources held by this class, notably the EGL context. */ public void release() { if (mEGLDisplay != EGL14.EglNoDisplay) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EglNoDisplay; mEGLContext = EGL14.EglNoContext; mEGLSurface = EGL14.EglNoSurface; mSurface.Release(); // this causes a bunch of warnings that appear harmless but might confuse someone: // W BufferQueue: [unnamed-3997-2] cancelBuffer: BufferQueue has been abandoned! //mSurfaceTexture.release(); mTextureRender = null; mSurface = null; mSurfaceTexture = null; }
private static EGLConfig GetEglConfig(EGLDisplay eglDisplay, int[] configAttributes) { var configs = new EGLConfig[1]; var numConfigs = new int[1]; if (!EGL14.EglChooseConfig(eglDisplay, configAttributes, 0, configs, 0, configs.Length, numConfigs, 0)) { throw new RuntimeException("eglChooseConfig failed: 0x" + Integer.ToHexString(EGL14.EglGetError())); } if (numConfigs[0] <= 0) { throw new RuntimeException("Unable to find any matching EGL config"); } EGLConfig eglConfig = configs[0]; if (eglConfig == null) { throw new RuntimeException("eglChooseConfig returned null"); } return(eglConfig); }
/** * Prepares EGL. We want a GLES 2.0 context and a surface that supports pbuffer. */ private void eglSetup() { mEGLDisplay = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay); if (mEGLDisplay == EGL14.EglNoDisplay) { throw new RuntimeException("unable to get EGL14 display"); } int[] version = new int[2]; if (!EGL14.EglInitialize(mEGLDisplay, version, 0, version, 1)) { mEGLDisplay = null; throw new RuntimeException("unable to initialize EGL14"); } // Configure EGL for pbuffer and OpenGL ES 2.0, 24-bit RGB. int[] attribList = { EGL14.EglRedSize, 8, EGL14.EglGreenSize, 8, EGL14.EglBlueSize, 8, EGL14.EglAlphaSize, 8, EGL14.EglRenderableType, EGL14.EglOpenglEs2Bit, EGL14.EglSurfaceType, EGL14.EglPbufferBit, EGL14.EglNone }; EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; if (!EGL14.EglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.Length, numConfigs, 0)) { throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config"); } // Configure context for OpenGL ES 2.0. int[] attrib_list = { EGL14.EglContextClientVersion, 2, EGL14.EglNone }; mEGLContext = EGL14.EglCreateContext(mEGLDisplay, configs[0], EGL14.EglNoContext, attrib_list, 0); checkEglError("eglCreateContext"); if (mEGLContext == null) { throw new RuntimeException("null context"); } // Create a pbuffer surface. int[] surfaceAttribs = { EGL14.EglWidth, mWidth, EGL14.EglHeight, mHeight, EGL14.EglNone }; mEGLSurface = EGL14.EglCreatePbufferSurface(mEGLDisplay, configs[0], surfaceAttribs, 0); checkEglError("eglCreatePbufferSurface"); if (mEGLSurface == null) { throw new RuntimeException("surface was null"); } }
public override void Run() { if (mSurfaceView.mHasGLContext.Get()) { return; } mEGLDisplay = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay); int[] version = new int[2]; EGL14.EglInitialize(mEGLDisplay, version, 0, version, 1); EGLConfig eglConfig = chooseEglConfig(mEGLDisplay); mEGLContext = EGL14 .EglCreateContext(mEGLDisplay, eglConfig, EGL14.EglNoContext, new int[] { EGL14.EglContextClientVersion, 2, EGL14.EglNone }, 0); int[] surfaceAttribs = { EGL14.EglNone }; mEGLSurface = EGL14 .EglCreateWindowSurface(mEGLDisplay, eglConfig, mSurfaceView, surfaceAttribs, 0); EGL14.EglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext); // guarantee to only report surface as created once GL context // associated with the surface has been created, and call on the GL thread // NOT the main thread but BEFORE the codec surface is attached to the GL context RendererCallbacks result; if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { result.onSurfaceCreated(); } mSurfaceView.mMediaSurfaceCreated.Set(false); GLES20.GlClearColor(0.1f, 0.1f, 0.1f, 1.0f); mSurfaceView.mHasGLContext.Set(true); if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { result.onContextCreated(); } mLoop.Set(true); while (mLoop.Get()) { if (!mSurfaceView.mPaused) { bool shouldRender = false; //we're just rendering when requested, so check that no one //has requested and if not, just continue if (mSurfaceView.mRenderMode.Get() == (int)Rendermode.WhenDirty) { if (mSurfaceView.mRenderRequested.Get()) { mSurfaceView.mRenderRequested.Set(false); shouldRender = true; } } else { shouldRender = true; } if (mSurfaceView.mSizeChange.Get()) { GLES20.GlViewport(0, 0, mSurfaceView.mWidth, mSurfaceView.mHeight); if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { result.onSurfaceChanged(mSurfaceView.mWidth, mSurfaceView.mHeight); } mSurfaceView.mSizeChange.Set(false); } if (shouldRender) { if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { result.onPreDrawFrame(); } if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { result.onDrawScreen(); } EGL14.EglSwapBuffers(mEGLDisplay, mEGLSurface); if (mSurfaceView.mIsRecording.Get()) { if (!mSurfaceView.mMediaSurfaceCreated.Get()) { mEGLSurfaceMedia = EGL14 .EglCreateWindowSurface(mEGLDisplay, eglConfig, mSurfaceView.mSurface, surfaceAttribs, 0); mSurfaceView.mMediaSurfaceCreated.Set(true); } EGL14.EglMakeCurrent(mEGLDisplay, mEGLSurfaceMedia, mEGLSurfaceMedia, mEGLContext); if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { GLES20.GlViewport(0, 0, mSurfaceView.mOutWidth, mSurfaceView.mOutHeight); //EGLExt.EglPresentationTimeANDROID(mEGLDisplay, mEGLSurfaceMedia, (JavaSystem.CurrentTimeMillis() - RecordableSurfaceView.mStartTimeMillisecs) * 1000L *1000L); result.onDrawRecording(); GLES20.GlViewport(0, 0, mSurfaceView.mWidth, mSurfaceView.mHeight); } EGL14.EglSwapBuffers(mEGLDisplay, mEGLSurfaceMedia); EGL14.EglMakeCurrent(mEGLDisplay, mEGLSurface, mEGLSurface, mEGLContext); } } while (mRunnableQueue.Count > 0) { Runnable ev = mRunnableQueue.First.Value; mRunnableQueue.RemoveFirst(); ev.Run(); } } /* try { Thread.Sleep((long)(1f / 120.0f * 1000f)); } catch (InterruptedException intex) // THIS IS KEY TO BLACKOUT BUG, THIS CATCH NEVER HAPPENS AND SO THE OLD SURFACE IS NEVER NUKED / REMADE mHasGLContext NEVER SET TO FALSE { if (mSurfaceView.mRendererCallbacksWeakReference != null && mSurfaceView.mRendererCallbacksWeakReference.TryGetTarget(out result)) { result.onSurfaceDestroyed(); } if (mEGLDisplay != null) { EGL14.EglMakeCurrent(mEGLDisplay, EGL14.EglNoSurface, EGL14.EglNoSurface, EGL14.EglNoContext); if (mEGLSurface != null) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurface); } if (mEGLSurfaceMedia != null) { EGL14.EglDestroySurface(mEGLDisplay, mEGLSurfaceMedia); } EGL14.EglDestroyContext(mEGLDisplay, mEGLContext); mSurfaceView.mHasGLContext.Set(false); EGL14.EglReleaseThread(); EGL14.EglTerminate(mEGLDisplay); mSurfaceView.mSurface.Release(); } return; }*/ } }
/** * Calls eglSwapBuffers. Use this to "publish" the current frame. */ public bool SwapBuffers() { return(EGL14.EglSwapBuffers(_EGLDisplay, _EGLSurface)); }
/** * Prepares EGL. We want a GLES 2.0 context and a surface that supports recording. */ private void EglSetup() { _EGLDisplay = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay); if (_EGLDisplay == EGL14.EglNoDisplay) { throw new RuntimeException("unable to get EGL14 display"); } int[] version = new int[2]; if (!EGL14.EglInitialize(_EGLDisplay, version, 0, version, 1)) { _EGLDisplay = null; throw new RuntimeException("unable to initialize EGL14"); } // Configure EGL for pbuffer and OpenGL ES 2.0. We want enough RGB bits // to be able to tell if the frame is reasonable. int[] attribList = { EGL14.EglRedSize, 8, EGL14.EglGreenSize, 8, EGL14.EglBlueSize, 8, EGL14.EglRenderableType, EGL_OPENGL_ES2_BIT, EGL_RECORDABLE_ANDROID, 1, EGL14.EglNone }; var configs = new EGLConfig[1]; var numConfigs = new int[1]; if (!EGL14.EglChooseConfig(_EGLDisplay, attribList, 0, configs, 0, configs.Length, numConfigs, 0)) { throw new RuntimeException("unable to find RGB888+recordable ES2 EGL config"); } // Configure context for OpenGL ES 2.0. int[] attrib_list = { EGL14.EglContextClientVersion, 2, EGL14.EglNone }; _EGLContext = EGL14.EglCreateContext(_EGLDisplay, configs[0], EGL14.EglNoContext, attrib_list, 0); CheckEglError("eglCreateContext"); if (_EGLContext == null) { throw new RuntimeException("null context"); } // Create a window surface, and attach it to the Surface we received. int[] surfaceAttribs = { EGL14.EglNone }; _EGLSurface = EGL14.EglCreateWindowSurface(_EGLDisplay, configs[0], _surface, surfaceAttribs, 0); CheckEglError("eglCreateWindowSurface"); if (_EGLSurface == null) { throw new RuntimeException("surface was null"); } }
public void swapBuffer() { EGL14.EglSwapBuffers(mEGLDisplay, mEGLSurface); }
/** * Prepares EGL. We want a GLES 2.0 context and a surface that supports recording. */ private void eglSetup() { mEGLDisplay = EGL14.EglGetDisplay(EGL14.EglDefaultDisplay); if (mEGLDisplay == EGL14.EglNoDisplay) { throw new Java.Lang.RuntimeException("unable to get EGL14 display"); } int[] version = new int[2]; if (!EGL14.EglInitialize(mEGLDisplay, version, 0, version, 1)) { throw new RuntimeException("unable to initialize EGL14"); } // Configure EGL for recording and OpenGL ES 2.0. int[] attribList; if (mEGLSharedContext == null) { attribList = new int[] { EGL14.EglRedSize, 8, EGL14.EglGreenSize, 8, EGL14.EglBlueSize, 8, EGL14.EglRenderableType, EGL14.EglOpenglEs2Bit, EGL14.EglNone }; } else { attribList = new int[] { EGL14.EglRedSize, 8, EGL14.EglGreenSize, 8, EGL14.EglBlueSize, 8, EGL14.EglRenderableType, EGL14.EglOpenglEs2Bit, EGL_RECORDABLE_ANDROID, 1, EGL14.EglNone }; } EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; EGL14.EglChooseConfig(mEGLDisplay, attribList, 0, configs, 0, configs.Length, numConfigs, 0); checkEglError("eglCreateContext RGB888+recordable ES2"); // Configure context for OpenGL ES 2.0. int[] attrib_list = { EGL14.EglContextClientVersion, 2, EGL14.EglNone }; if (mEGLSharedContext == null) { mEGLContext = EGL14.EglCreateContext(mEGLDisplay, configs[0], EGL14.EglNoContext, attrib_list, 0); } else { mEGLContext = EGL14.EglCreateContext(mEGLDisplay, configs[0], mEGLSharedContext, attrib_list, 0); } checkEglError("eglCreateContext"); // Create a window surface, and attach it to the Surface we received. int[] surfaceAttribs = { EGL14.EglNone }; mEGLSurface = EGL14.EglCreateWindowSurface(mEGLDisplay, configs[0], mSurface, surfaceAttribs, 0); checkEglError("eglCreateWindowSurface"); GLES20.GlDisable(GLES20.GlDepthTest); GLES20.GlDisable(GLES20.GlCullFaceMode); }