public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) { EGLSurface result = null; try { result = egl.eglCreateWindowSurface(display, config, nativeWindow, null); } 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(TAG, "eglCreateWindowSurface", e); } return result; }
public void initDrawContext( EGL10 egl, EGLDisplay eglDisplay, EGLSurface eglSurface, EGLContext eglContext) { mEgl = egl; mEglDisplay = eglDisplay; mEglSurface = eglSurface; mEglContext = eglContext; if (0 == mMapId) { return; } // makeCurrent(); Api.ngsMapInit(mMapId); }
public EGLSurface createWindowSurface( EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) { mEglSurface = null; try { mEglSurface = egl.eglCreateWindowSurface(display, config, nativeWindow, null); if (EGL10.EGL_NO_SURFACE == mEglSurface) { throwEglException(egl, "eglCreateWindowSurface"); } } catch (IllegalArgumentException e) { Log.e(ConstantsUI.TAG, "eglCreateWindowSurface", e); throw new RuntimeException("eglCreateWindowSurface", e); } return mEglSurface; }
@Override public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) { int[] surfaceAttribs = { EGL10.EGL_NONE }; EGLSurface result = null; try { result = egl.eglCreateWindowSurface(display, config, nativeWindow, surfaceAttribs); } 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("DefaultWindow", "eglCreateWindowSurface", e); } return result; }
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1) @Override public android.opengl.EGLSurface createWindowSurface(android.opengl.EGLDisplay display, android.opengl.EGLConfig config, Object nativeWindow) { int[] surfaceAttribs = { EGL14.EGL_NONE }; android.opengl.EGLSurface result = null; try { result = EGL14.eglCreateWindowSurface(display, config, nativeWindow, surfaceAttribs, 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("DefaultWindow", "eglCreateWindowSurface", e); } return result; }
/** * change context to draw this window surface * @return */ private final boolean makeCurrent(final EGLSurface surface) { // if (DEBUG) Log.v(TAG, "makeCurrent:"); /* if (mEglDisplay == null) { if (DEBUG) Log.d(TAG, "makeCurrent:eglDisplay not initialized"); } */ if (surface == null || surface == EGL10.EGL_NO_SURFACE) { final int error = mEgl.eglGetError(); if (error == EGL10.EGL_BAD_NATIVE_WINDOW) { Log.e(TAG, "makeCurrent:EGL_BAD_NATIVE_WINDOW"); } return false; } // attach EGL rendering context to specific EGL window surface if (!mEgl.eglMakeCurrent(mEglDisplay, surface, surface, mContext.eglContext)) { Log.w("TAG", "eglMakeCurrent" + mEgl.eglGetError()); return false; } return true; }
@Override public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) { EGLSurface result = null; try { result = egl.eglCreateWindowSurface(display, config, nativeWindow, null); } 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(TAG, "eglCreateWindowSurface", e); } return result; }
public EGLSurface createWindowSurface( EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) { mEglSurface = null; try { mEglSurface = egl.eglCreateWindowSurface(display, config, nativeWindow, null); if (EGL10.EGL_NO_SURFACE == mEglSurface) { throwEglException(egl, "eglCreateWindowSurface"); } } catch (IllegalArgumentException e) { Log.e(Constants.TAG, "eglCreateWindowSurface", e); throw new RuntimeException("eglCreateWindowSurface", e); } return mEglSurface; }
public EGLSurface createWindowSurface(EGL10 egl, EGLDisplay display, EGLConfig config, Object nativeWindow) { EGLSurface result = null; try { result = egl.eglCreateWindowSurface(display, config, nativeWindow, null); } 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 SurfaceTexture.Callback.surfaceDestroyed. // In theory the application should be notified first, // but in practice sometimes it is not. See b/4588890 Log.e(TAG, "eglCreateWindowSurface", e); } return result; }
private static void addExtensionsForConfig(EGL10 paramEGL10, EGLDisplay paramEGLDisplay, EGLConfig paramEGLConfig, int[] paramArrayOfInt1, int[] paramArrayOfInt2, Set<String> paramSet) { EGLContext localEGLContext = paramEGL10.eglCreateContext(paramEGLDisplay, paramEGLConfig, EGL10.EGL_NO_CONTEXT, paramArrayOfInt2); if (localEGLContext == EGL10.EGL_NO_CONTEXT) { return; } EGLSurface localEGLSurface = paramEGL10.eglCreatePbufferSurface(paramEGLDisplay, paramEGLConfig, paramArrayOfInt1); if (localEGLSurface == EGL10.EGL_NO_SURFACE) { paramEGL10.eglDestroyContext(paramEGLDisplay, localEGLContext); return; } paramEGL10.eglMakeCurrent(paramEGLDisplay, localEGLSurface, localEGLSurface, localEGLContext); String str = GLES10.glGetString(7939); if (!TextUtils.isEmpty(str)) { String[] arrayOfString = str.split(" "); int i = arrayOfString.length; for (int j = 0; j < i; j++) { paramSet.add(arrayOfString[j]); } } paramEGL10.eglMakeCurrent(paramEGLDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); paramEGL10.eglDestroySurface(paramEGLDisplay, localEGLSurface); paramEGL10.eglDestroyContext(paramEGLDisplay, localEGLContext); }
/** * Clears the frames from the current surface. This should only be called when * the implementing video view has finished playback or otherwise released * the surface */ @Override public void clearSurface() { try { EGL10 gl10 = (EGL10) EGLContext.getEGL(); EGLDisplay display = gl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); gl10.eglInitialize(display, null); EGLConfig[] configs = new EGLConfig[1]; gl10.eglChooseConfig(display, GL_CLEAR_CONFIG_ATTRIBUTES, configs, configs.length, new int[1]); EGLContext context = gl10.eglCreateContext(display, configs[0], EGL10.EGL_NO_CONTEXT, GL_CLEAR_CONTEXT_ATTRIBUTES); EGLSurface eglSurface = gl10.eglCreateWindowSurface(display, configs[0], this, new int[]{EGL10.EGL_NONE}); gl10.eglMakeCurrent(display, eglSurface, eglSurface, context); gl10.eglSwapBuffers(display, eglSurface); gl10.eglDestroySurface(display, eglSurface); gl10.eglMakeCurrent(display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); gl10.eglDestroyContext(display, context); gl10.eglTerminate(display); } catch (Exception e) { Log.e(TAG, "Error clearing surface", e); } }
public void destroySurface( EGL10 egl, EGLDisplay display, EGLSurface surface) { // mMapDrawing.releaseCurrent(); if (!egl.eglDestroySurface(display, surface)) { throwEglException(egl, "eglDestroySurface"); } mEglSurface = null; }
/** * clear data from surface using opengl */ private void clearSurface(Object texture) { EGL10 egl = (EGL10) EGLContext.getEGL(); EGLDisplay display = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY); egl.eglInitialize(display, null); int[] attribList = { EGL10.EGL_RED_SIZE, 8, EGL10.EGL_GREEN_SIZE, 8, EGL10.EGL_BLUE_SIZE, 8, EGL10.EGL_ALPHA_SIZE, 8, EGL10.EGL_RENDERABLE_TYPE, EGL10.EGL_WINDOW_BIT, EGL10.EGL_NONE, 0, // placeholder for recordable [@-3] EGL10.EGL_NONE }; EGLConfig[] configs = new EGLConfig[1]; int[] numConfigs = new int[1]; egl.eglChooseConfig(display, attribList, configs, configs.length, numConfigs); EGLConfig config = configs[0]; EGLContext context = egl.eglCreateContext(display, config, EGL10.EGL_NO_CONTEXT, new int[] { 12440, 2, EGL10.EGL_NONE }); EGLSurface eglSurface = egl.eglCreateWindowSurface(display, config, texture, new int[] { EGL10.EGL_NONE }); egl.eglMakeCurrent(display, eglSurface, eglSurface, context); GLES20.glClearColor(0, 0, 0, 1); GLES20.glClear(GLES20.GL_COLOR_BUFFER_BIT); egl.eglSwapBuffers(display, eglSurface); egl.eglDestroySurface(display, eglSurface); egl.eglMakeCurrent(display, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT); egl.eglDestroyContext(display, context); egl.eglTerminate(display); }
public boolean eglCopyBuffers(EGLDisplay display, EGLSurface surface, Object native_pixmap) { begin("eglCopyBuffers"); arg("display", display); arg("surface", surface); arg("native_pixmap", native_pixmap); end(); boolean result = mEgl10.eglCopyBuffers(display, surface, native_pixmap); returns(result); checkError(); return result; }
public EGLSurface eglCreatePbufferSurface(EGLDisplay display, EGLConfig config, int[] attrib_list) { begin("eglCreatePbufferSurface"); arg("display", display); arg("config", config); arg("attrib_list", attrib_list); end(); EGLSurface result = mEgl10.eglCreatePbufferSurface(display, config, attrib_list); returns(result); checkError(); return result; }
public EGLSurface eglCreatePixmapSurface(EGLDisplay display, EGLConfig config, Object native_pixmap, int[] attrib_list) { begin("eglCreatePixmapSurface"); arg("display", display); arg("config", config); arg("native_pixmap", native_pixmap); arg("attrib_list", attrib_list); end(); EGLSurface result = mEgl10.eglCreatePixmapSurface(display, config, native_pixmap, attrib_list); returns(result); checkError(); return result; }
public EGLSurface eglCreateWindowSurface(EGLDisplay display, EGLConfig config, Object native_window, int[] attrib_list) { begin("eglCreateWindowSurface"); arg("display", display); arg("config", config); arg("native_window", native_window); arg("attrib_list", attrib_list); end(); EGLSurface result = mEgl10.eglCreateWindowSurface(display, config, native_window, attrib_list); returns(result); checkError(); return result; }
public boolean eglDestroySurface(EGLDisplay display, EGLSurface surface) { begin("eglDestroySurface"); arg("display", display); arg("surface", surface); end(); boolean result = mEgl10.eglDestroySurface(display, surface); returns(result); checkError(); return result; }
public EGLSurface eglGetCurrentSurface(int readdraw) { begin("eglGetCurrentSurface"); arg("readdraw", readdraw); end(); EGLSurface result = mEgl10.eglGetCurrentSurface(readdraw); returns(result); checkError(); return result; }
public boolean eglMakeCurrent(EGLDisplay display, EGLSurface draw, EGLSurface read, EGLContext context) { begin("eglMakeCurrent"); arg("display", display); arg("draw", draw); arg("read", read); arg("context", context); end(); boolean result = mEgl10.eglMakeCurrent(display, draw, read, context); returns(result); checkError(); return result; }
public boolean eglQuerySurface(EGLDisplay display, EGLSurface surface, int attribute, int[] value) { begin("eglQuerySurface"); arg("display", display); arg("surface", surface); arg("attribute", attribute); end(); boolean result = mEgl10.eglQuerySurface(display, surface, attribute, value); returns(value[0]); returns(result); checkError(); return result; }
public boolean eglSwapBuffers(EGLDisplay display, EGLSurface surface) { begin("eglSwapBuffers"); arg("display", display); arg("surface", surface); end(); boolean result = mEgl10.eglSwapBuffers(display, surface); returns(result); checkError(); return result; }
private void arg(String name, EGLSurface object) { if (object == EGL10.EGL_NO_SURFACE) { arg(name, "EGL10.EGL_NO_SURFACE"); } else { arg(name, toString(object)); } }