android.opengl.EGLSurface Java Examples
The following examples show how to use
android.opengl.EGLSurface.
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: GLSurfaceView2.java From java6-android-glframework with Mozilla Public License 2.0 | 6 votes |
public EGLSurface createWindowSurface(EGLDisplay display, EGLConfig config, Object nativeWindow) { EGLSurface result = null; try { result = EGL14.eglCreateWindowSurface(display, config, nativeWindow, s_DEFAULT_SURFACE_ATTRIBS, 0); } catch (IllegalArgumentException e) { // This exception indicates that the surface flinger surface // is not valid. This can happen if the surface flinger surface has // been torn down, but the application has not yet been // notified via SurfaceHolder.Callback.surfaceDestroyed. // In theory the application should be notified first, // but in practice sometimes it is not. See b/4588890 Log.e(s_TAG, "eglCreateWindowSurface", e); } return result; }
Example #2
Source File: EglCore.java From grafika with Apache License 2.0 | 6 votes |
/** * Creates an EGL surface associated with a Surface. * <p> * If this is destined for MediaCodec, the EGLConfig should have the "recordable" attribute. */ public EGLSurface createWindowSurface(Object surface) { if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) { throw new RuntimeException("invalid surface: " + surface); } // Create a window surface, and attach it to the Surface we received. int[] surfaceAttribs = { EGL14.EGL_NONE }; EGLSurface eglSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surface, surfaceAttribs, 0); checkEglError("eglCreateWindowSurface"); if (eglSurface == null) { throw new RuntimeException("surface was null"); } return eglSurface; }
Example #3
Source File: EglCore.java From pause-resume-video-recording with Apache License 2.0 | 6 votes |
/** * Creates an EGL surface associated with a Surface. * <p> * If this is destined for MediaCodec, the EGLConfig should have the "recordable" attribute. */ public EGLSurface createWindowSurface(Object surface) { if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) { throw new RuntimeException("invalid surface: " + surface); } // Create a window surface, and attach it to the Surface we received. int[] surfaceAttribs = { EGL14.EGL_NONE }; EGLSurface eglSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surface, surfaceAttribs, 0); checkEglError("eglCreateWindowSurface"); if (eglSurface == null) { throw new RuntimeException("surface was null"); } return eglSurface; }
Example #4
Source File: EGLBase.java From AudioVideoPlayerSample with Apache License 2.0 | 6 votes |
/** * change context to draw this window surface * @return */ private boolean makeCurrent(EGLSurface surface) { if (DEBUG) Log.v(TAG, "makeCurrent:"); if (mEglDisplay == null) { if (DEBUG) Log.d(TAG, "makeCurrent:eglDisplay not initialized"); } if (surface == null || surface == EGL14.EGL_NO_SURFACE) { int error = EGL14.eglGetError(); if (error == EGL14.EGL_BAD_NATIVE_WINDOW) { Log.e(TAG, "makeCurrent:returned EGL_BAD_NATIVE_WINDOW."); } return false; } // attach EGL renderring context to specific EGL window surface if (!EGL14.eglMakeCurrent(mEglDisplay, surface, surface, mEglContext)) { Log.w("TAG", "eglMakeCurrent" + EGL14.eglGetError()); return false; } return true; }
Example #5
Source File: EGLBase.java From Tok-Android with GNU General Public License v3.0 | 6 votes |
/** * change context to draw this window surface */ private boolean makeCurrent(final EGLSurface surface) { // if (DEBUG) Log.v(TAG, "makeCurrent:"); if (mEglDisplay == null) { LogUtil.i(TAG, "makeCurrent:eglDisplay not initialized"); } if (surface == null || surface == EGL14.EGL_NO_SURFACE) { final int error = EGL14.eglGetError(); if (error == EGL14.EGL_BAD_NATIVE_WINDOW) { Log.e(TAG, "makeCurrent:returned EGL_BAD_NATIVE_WINDOW."); } return false; } // attach EGL renderring context to specific EGL window surface if (!EGL14.eglMakeCurrent(mEglDisplay, surface, surface, mEglContext)) { Log.w(TAG, "eglMakeCurrent:" + EGL14.eglGetError()); return false; } return true; }
Example #6
Source File: EGLBase14.java From libcommon with Apache License 2.0 | 5 votes |
private void destroyWindowSurface(EGLSurface surface) { // if (DEBUG) Log.v(TAG, "destroySurface:"); if (surface != EGL14.EGL_NO_SURFACE) { EGL14.eglMakeCurrent(mEglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroySurface(mEglDisplay, surface); } // if (DEBUG) Log.v(TAG, "destroySurface:finished"); }
Example #7
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 #8
Source File: CodecInputSurface.java From DeviceConnect-Android with MIT License | 5 votes |
@Override EGLSurface createEGLSurface(EGLDisplay display, EGLConfig[] configs) { // Create a window surface, and attach it to the Surface we received. int[] surfaceAttribs = { EGL14.EGL_NONE }; EGLSurface surface = EGL14.eglCreateWindowSurface(display, configs[0], mSurface, surfaceAttribs, 0); checkEglError("eglCreateWindowSurface"); return surface; }
Example #9
Source File: EGLBase.java From In77Camera with MIT License | 5 votes |
private void destroyWindowSurface(EGLSurface surface) { if (DEBUG) Log.v(TAG, "destroySurface:"); if (surface != EGL14.EGL_NO_SURFACE) { EGL14.eglMakeCurrent(mEglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroySurface(mEglDisplay, surface); } surface = EGL14.EGL_NO_SURFACE; if (DEBUG) Log.v(TAG, "destroySurface:finished"); }
Example #10
Source File: EGLBase14.java From libcommon with Apache License 2.0 | 5 votes |
/** * 現在のスレッドの既存のレンダリングコンテキストがあればそれを共有して * 新しいレンダリングコンテキストを生成する * 既存のレンダリングコンテキストが存在していなければ独立したレンダリングコンテキストを * 生成する * @param maxClientVersion * @param withDepthBuffer * @param stencilBits * @param isRecordable * @return */ /*package*/ static EGLBase createFromCurrentImpl(final int maxClientVersion, final boolean withDepthBuffer, final int stencilBits, final boolean isRecordable) { Context context = null; final EGLContext currentContext = EGL14.eglGetCurrentContext(); final EGLSurface currentSurface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW); if ((currentContext != null) && (currentSurface != null)) { context = wrap(currentContext); } return new EGLBase14(maxClientVersion, context, withDepthBuffer, stencilBits, isRecordable); }
Example #11
Source File: EglCore.java From pause-resume-video-recording with Apache License 2.0 | 5 votes |
/** * Creates an EGL surface associated with an offscreen buffer. */ public EGLSurface createOffscreenSurface(int width, int height) { int[] surfaceAttribs = { EGL14.EGL_WIDTH, width, EGL14.EGL_HEIGHT, height, EGL14.EGL_NONE }; EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, surfaceAttribs, 0); checkEglError("eglCreatePbufferSurface"); if (eglSurface == null) { throw new RuntimeException("surface was null"); } return eglSurface; }
Example #12
Source File: EGLBase.java From MegviiFacepp-Android-SDK with Apache License 2.0 | 5 votes |
private void destroyWindowSurface(EGLSurface surface) { if (DEBUG) Log.v(TAG, "destroySurface:"); if (surface != EGL14.EGL_NO_SURFACE) { EGL14.eglMakeCurrent(mEglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroySurface(mEglDisplay, surface); } surface = EGL14.EGL_NO_SURFACE; if (DEBUG) Log.v(TAG, "destroySurface:finished"); }
Example #13
Source File: EGLBase.java From AudioVideoPlayerSample with Apache License 2.0 | 5 votes |
private EGLSurface createWindowSurface(Object nativeWindow) { if (DEBUG) Log.v(TAG, "createWindowSurface:"); final int[] surfaceAttribs = { EGL14.EGL_NONE }; EGLSurface result = null; try { result = EGL14.eglCreateWindowSurface(mEglDisplay, mEglConfig, nativeWindow, surfaceAttribs, 0); } catch (IllegalArgumentException e) { Log.e(TAG, "eglCreateWindowSurface", e); } return result; }
Example #14
Source File: EglCore.java From VIA-AI 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: EglHelper.java From AAVT with Apache License 2.0 | 5 votes |
public boolean destroyGLES(EGLSurface surface,EGLContext context){ EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); if(surface!=null){ EGL14.eglDestroySurface(mEGLDisplay,surface); } if(context!=null){ EGL14.eglDestroyContext(mEGLDisplay,context); } EGL14.eglTerminate(mEGLDisplay); log("gl destroy gles"); return true; }
Example #16
Source File: EglCore.java From Lassi-Android with MIT License | 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 #17
Source File: EglCore.java From cineio-broadcast-android with MIT License | 5 votes |
/** * Writes the current display, context, and surface to the log. */ public static void logCurrent(String msg) { EGLDisplay display; EGLContext context; EGLSurface surface; display = EGL14.eglGetCurrentDisplay(); context = EGL14.eglGetCurrentContext(); surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW); Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context + ", surface=" + surface); }
Example #18
Source File: EglCore.java From RtmpPublisher with Apache License 2.0 | 5 votes |
/** * Writes the current display, context, and surface to the log. */ public static void logCurrent(String msg) { EGLDisplay display; EGLContext context; EGLSurface surface; display = EGL14.eglGetCurrentDisplay(); context = EGL14.eglGetCurrentContext(); surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW); Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context + ", surface=" + surface); }
Example #19
Source File: EGLBase.java From CameraRecorder-android with MIT License | 5 votes |
EGLSurface createWindowSurface(final Object surface) { if (DEBUG) Log.v(TAG, "createWindowSurface:nativeWindow=" + surface); final int[] surfaceAttribs = { EGL14.EGL_NONE }; EGLSurface result = null; try { result = EGL14.eglCreateWindowSurface(eglDisplay, eglConfig, surface, surfaceAttribs, 0); } catch (final IllegalArgumentException e) { Log.e(TAG, "eglCreateWindowSurface", e); } return result; }
Example #20
Source File: EGLBase.java From AudioVideoPlayerSample with Apache License 2.0 | 5 votes |
private void destroyWindowSurface(EGLSurface surface) { if (DEBUG) Log.v(TAG, "destroySurface:"); if (surface != EGL14.EGL_NO_SURFACE) { EGL14.eglMakeCurrent(mEglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT); EGL14.eglDestroySurface(mEglDisplay, surface); } surface = EGL14.EGL_NO_SURFACE; }
Example #21
Source File: EglCore.java From MockCamera with Apache License 2.0 | 5 votes |
/** * Makes our EGL context current, using the supplied surface for both "draw" and "read". */ public void makeCurrent(EGLSurface eglSurface) { if (eGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG,"NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(eGLDisplay, eglSurface, eglSurface, eGLContext)) { throw new RuntimeException("eglMakeCurrent failed"); } }
Example #22
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 #23
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 #24
Source File: EglCore.java From AndroidPlayground with MIT License | 5 votes |
/** * Creates an EGL surface associated with an offscreen buffer. */ public EGLSurface createOffscreenSurface(int width, int height) { int[] surfaceAttribs = { EGL14.EGL_WIDTH, width, EGL14.EGL_HEIGHT, height, EGL14.EGL_NONE }; EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, surfaceAttribs, 0); checkEglError("eglCreatePbufferSurface"); if (eglSurface == null) { throw new RuntimeException("surface was null"); } return eglSurface; }
Example #25
Source File: EglCore.java From IjkVRPlayer with Apache License 2.0 | 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 #26
Source File: EglCore.java From AndroidPlayground 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 #27
Source File: EglCore.java From sealrtc-android with MIT License | 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 #28
Source File: EglCore.java From AndroidPlayground with MIT License | 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 #29
Source File: EglCore.java From cineio-broadcast-android with MIT License | 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 #30
Source File: EglCore.java From sealrtc-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"); } }