Java Code Examples for android.opengl.EGL14#EGL_NO_DISPLAY
The following examples show how to use
android.opengl.EGL14#EGL_NO_DISPLAY .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EglCore.java From mobile-ar-sensor-logger with GNU General Public License v3.0 | 6 votes |
/** * Discards all resources held by this class, notably the EGL context. This must be * called from the thread where the context was created. * <p> * On completion, no context will be current. */ public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroyContext(mEGLDisplay, mEGLContext); EGL14.eglReleaseThread(); EGL14.eglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EGL_NO_DISPLAY; mEGLContext = EGL14.EGL_NO_CONTEXT; mEGLConfig = null; }
Example 2
Source File: EglCore.java From TikTok with Apache License 2.0 | 6 votes |
@Override protected void finalize() throws Throwable { try { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // We're limited here -- finalizers don't run on the thread that holds // the EGL state, so if a surface or context is still current on another // thread we can't fully release it here. Exceptions thrown from here // are quietly discarded. Complain in the log file. Log.w(TAG, "WARNING: EglCore was not explicitly released -- state may be leaked"); release(); } }catch (Exception e){ e.printStackTrace(); } finally{ super.finalize(); } }
Example 3
Source File: EglCore.java From VideoRecorder with Apache License 2.0 | 6 votes |
/** * Discards all resources held by this class, notably the EGL context. This must be * called from the thread where the context was created. * <p> * On completion, no context will be current. */ public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroyContext(mEGLDisplay, mEGLContext); EGL14.eglReleaseThread(); EGL14.eglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EGL_NO_DISPLAY; mEGLContext = EGL14.EGL_NO_CONTEXT; mEGLConfig = null; }
Example 4
Source File: EglCore.java From LiveVideoBroadcaster with Apache License 2.0 | 6 votes |
/** * Discards all resources held by this class, notably the EGL activity. This must be * called from the thread where the activity was created. * <p> * On completion, no activity will be current. */ public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroyContext(mEGLDisplay, mEGLContext); EGL14.eglReleaseThread(); EGL14.eglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EGL_NO_DISPLAY; mEGLContext = EGL14.EGL_NO_CONTEXT; mEGLConfig = null; }
Example 5
Source File: EglCore.java From TikTok with Apache License 2.0 | 6 votes |
/** * Discards all resources held by this class, notably the EGL context. This must be * called from the thread where the context was created. * <p> * On completion, no context will be current. */ public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroyContext(mEGLDisplay, mEGLContext); EGL14.eglReleaseThread(); EGL14.eglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EGL_NO_DISPLAY; mEGLContext = EGL14.EGL_NO_CONTEXT; mEGLConfig = null; }
Example 6
Source File: EglCore.java From sealrtc-android with MIT License | 5 votes |
@Override protected void finalize() throws Throwable { try { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // We're limited here -- finalizers don't run on the thread that holds // the EGL state, so if a surface or context is still current on another // thread we can't fully release it here. Exceptions thrown from here // are quietly discarded. Complain in the log file. Log.w(TAG, "WARNING: EglCore was not explicitly released -- state may be leaked"); release(); } } finally { super.finalize(); } }
Example 7
Source File: EglCore.java From grafika with Apache License 2.0 | 5 votes |
@Override protected void finalize() throws Throwable { try { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // We're limited here -- finalizers don't run on the thread that holds // the EGL state, so if a surface or context is still current on another // thread we can't fully release it here. Exceptions thrown from here // are quietly discarded. Complain in the log file. Log.w(TAG, "WARNING: EglCore was not explicitly released -- state may be leaked"); release(); } } finally { super.finalize(); } }
Example 8
Source File: EglCore.java From Fatigue-Detection with MIT License | 5 votes |
/** * Makes our EGL context current, using the supplied surface for both "draw" and "read". */ public void makeCurrent(EGLSurface eglSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent failed"); } }
Example 9
Source File: EglCore.java From PhotoMovie with Apache License 2.0 | 5 votes |
/** * Makes our EGL context current, using the supplied "draw" and "read" surfaces. */ public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent(draw,read) failed"); } }
Example 10
Source File: EglCore.java From IjkVRPlayer with Apache License 2.0 | 5 votes |
/** * Makes our EGL context current, using the supplied "draw" and "read" surfaces. */ public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent(draw,read) failed"); } }
Example 11
Source File: EglCore.java From Lassi-Android with MIT License | 5 votes |
/** * Makes our EGL context current, using the supplied surface for both "draw" and "read". */ public void makeCurrent(EGLSurface eglSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? // Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent failed"); } }
Example 12
Source File: EglCore.java From Lassi-Android with MIT License | 5 votes |
@Override protected void finalize() throws Throwable { try { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // We're limited here -- finalizers don't run on the thread that holds // the EGL state, so if a surface or context is still current on another // thread we can't fully release it here. Exceptions thrown from here // are quietly discarded. Complain in the log file. Log.w(TAG, "WARNING: EglCore was not explicitly released -- state may be leaked"); release(); } } finally { super.finalize(); } }
Example 13
Source File: EGLBase.java From AudioVideoRecordingSample with Apache License 2.0 | 5 votes |
private void init(EGLContext shared_context, final boolean with_depth_buffer, final boolean isRecordable) { if (DEBUG) Log.v(TAG, "init:"); if (mEglDisplay != EGL14.EGL_NO_DISPLAY) { throw new RuntimeException("EGL already set up"); } mEglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); if (mEglDisplay == EGL14.EGL_NO_DISPLAY) { throw new RuntimeException("eglGetDisplay failed"); } final int[] version = new int[2]; if (!EGL14.eglInitialize(mEglDisplay, version, 0, version, 1)) { mEglDisplay = null; throw new RuntimeException("eglInitialize failed"); } shared_context = shared_context != null ? shared_context : EGL14.EGL_NO_CONTEXT; if (mEglContext == EGL14.EGL_NO_CONTEXT) { mEglConfig = getConfig(with_depth_buffer, isRecordable); if (mEglConfig == null) { throw new RuntimeException("chooseConfig failed"); } // create EGL rendering context mEglContext = createContext(shared_context); } // confirm whether the EGL rendering context is successfully created final int[] values = new int[1]; EGL14.eglQueryContext(mEglDisplay, mEglContext, EGL14.EGL_CONTEXT_CLIENT_VERSION, values, 0); if (DEBUG) Log.d(TAG, "EGLContext created, client version " + values[0]); makeDefault(); // makeCurrent(EGL14.EGL_NO_SURFACE); }
Example 14
Source File: EglCore.java From cineio-broadcast-android with MIT License | 5 votes |
/** * Makes our EGL context current, using the supplied surface for both "draw" and "read". */ public void makeCurrent(EGLSurface eglSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent failed"); } }
Example 15
Source File: EglCore.java From TikTok with Apache License 2.0 | 5 votes |
/** * Makes our EGL context current, using the supplied "draw" and "read" surfaces. */ public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent(draw,read) failed"); } }
Example 16
Source File: EglCore.java From FuAgoraDemoDroid with MIT License | 5 votes |
/** * Makes our EGL context current, using the supplied surface for both "draw" and "read". */ public void makeCurrent(EGLSurface eglSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent failed"); } }
Example 17
Source File: EGLBase.java From Fatigue-Detection with MIT License | 5 votes |
public void release() { if (DEBUG) Log.v(TAG, "release:"); if (mEglDisplay != EGL14.EGL_NO_DISPLAY) { destroyContext(); EGL14.eglTerminate(mEglDisplay); EGL14.eglReleaseThread(); } mEglDisplay = EGL14.EGL_NO_DISPLAY; mEglContext = EGL14.EGL_NO_CONTEXT; }
Example 18
Source File: EglCore.java From kickflip-android-sdk with Apache License 2.0 | 5 votes |
/** * Discard all resources held by this class, notably the EGL context. */ public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroyContext(mEGLDisplay, mEGLContext); EGL14.eglReleaseThread(); EGL14.eglTerminate(mEGLDisplay); } mEGLDisplay = EGL14.EGL_NO_DISPLAY; mEGLContext = EGL14.EGL_NO_CONTEXT; mEGLConfig = null; }
Example 19
Source File: EglCore.java From LiveVideoBroadcaster with Apache License 2.0 | 5 votes |
/** * Makes our EGL activity current, using the supplied "draw" and "read" surfaces. */ public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGLContext)) { throw new RuntimeException("eglMakeCurrent(draw,read) failed"); } }
Example 20
Source File: OutputSurface.java From phoenix with Apache License 2.0 | 4 votes |
/** * Prepares EGL. We want a GLES 2.0 context and a surface that supports pbuffer. */ private void eglSetup(int width, int height) { mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY); if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { 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. We want enough RGB bits // to be able to tell if the frame is reasonable. int[] attribList = { EGL14.EGL_RED_SIZE, 8, EGL14.EGL_GREEN_SIZE, 8, EGL14.EGL_BLUE_SIZE, 8, EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT, EGL14.EGL_SURFACE_TYPE, EGL14.EGL_PBUFFER_BIT, EGL14.EGL_NONE }; 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.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE }; mEGLContext = EGL14.eglCreateContext(mEGLDisplay, configs[0], EGL14.EGL_NO_CONTEXT, attrib_list, 0); checkEglError("eglCreateContext"); if (mEGLContext == null) { throw new RuntimeException("null context"); } // Create a pbuffer surface. By using this for output, we can use glReadPixels // to test values in the output. int[] surfaceAttribs = { EGL14.EGL_WIDTH, width, EGL14.EGL_HEIGHT, height, EGL14.EGL_NONE }; mEGLSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, configs[0], surfaceAttribs, 0); checkEglError("eglCreatePbufferSurface"); if (mEGLSurface == null) { throw new RuntimeException("surface was null"); } }