Java Code Examples for android.opengl.EGL14#eglGetError()

The following examples show how to use android.opengl.EGL14#eglGetError() . 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: EGLBase.java    From UVCCameraZxing with Apache License 2.0 6 votes vote down vote up
/**
	 * change context to draw this window surface
	 * @return
	 */
	private 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 == 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 2
Source File: EGLBase.java    From Fatigue-Detection with MIT License 6 votes vote down vote up
/**
	 * change context to draw this window surface
	 * @return
	 */
	private 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 == 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 3
Source File: EglCore.java    From pause-resume-video-recording with Apache License 2.0 5 votes vote down vote up
/**
 * Checks for EGL errors.  Throws an exception if an error has been raised.
 */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 4
Source File: EglCore.java    From sealrtc-android with MIT License 5 votes vote down vote up
/** Checks for EGL errors. Throws an exception if an error has been raised. */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 5
Source File: EglUtil.java    From SimpleVideoEditor with Apache License 2.0 5 votes vote down vote up
static void releaseAndTerminate(EGLDisplay eglDisplay) {
    int error;
    EGL14.eglReleaseThread();
    error = EGL14.eglGetError();
    if (error != EGL14.EGL_SUCCESS) {
        throw new RuntimeException("error releasing thread: " + error);
    }
    EGL14.eglTerminate(eglDisplay);
    error = EGL14.eglGetError();
    if (error != EGL14.EGL_SUCCESS) {
        throw new RuntimeException("error terminating display: " + error);
    }
}
 
Example 6
Source File: OutputSurface.java    From phoenix with Apache License 2.0 5 votes vote down vote up
/**
 * Checks for EGL errors.
 */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 7
Source File: OutputSurface.java    From android-transcoder with Apache License 2.0 5 votes vote down vote up
/**
 * Checks for EGL errors.
 */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 8
Source File: EglCore.java    From PhotoMovie with Apache License 2.0 5 votes vote down vote up
/**
 * Checks for EGL errors.  Throws an exception if an error has been raised.
 */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 9
Source File: EncoderSurface.java    From Mp4Composer-android with MIT License 5 votes vote down vote up
/**
 * Checks for EGL errors.
 */
private static void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 10
Source File: EglHelperAPI17.java    From android-openGL-canvas with Apache License 2.0 5 votes vote down vote up
@Override
public int swap() {
    if (!EGL14.eglSwapBuffers(mEglDisplay, mEglSurface)) {
        FileLogger.w(TAG, String.format("swap: start get error"));
        return EGL14.eglGetError();
    }
    return EGL14.EGL_SUCCESS;
}
 
Example 11
Source File: InputSurface.java    From react-native-video-helper with MIT License 5 votes vote down vote up
private void checkEglError(String msg) {
    boolean failed = false;
    int error;
    while ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        failed = true;
    }
    if (failed) {
        throw new RuntimeException("EGL error encountered (see log)");
    }
}
 
Example 12
Source File: SurfaceTextureRenderer.java    From android_9.0.0_r45 with Apache License 2.0 5 votes vote down vote up
private boolean swapBuffers(EGLSurface surface)
        throws LegacyExceptionUtils.BufferQueueAbandonedException {
    boolean result = EGL14.eglSwapBuffers(mEGLDisplay, surface);

    int error = EGL14.eglGetError();
    switch (error) {
        case EGL14.EGL_SUCCESS:
            return result;

        // Check for an abandoned buffer queue, or other error conditions out
        // of the user's control.
        //
        // From the EGL 1.4 spec (2013-12-04), Section 3.9.4 Posting Errors:
        //
        //   If eglSwapBuffers is called and the native window associated with
        //   surface is no longer valid, an EGL_BAD_NATIVE_WINDOW error is
        //   generated.
        //
        // We also interpret EGL_BAD_SURFACE as indicating an abandoned
        // surface, even though the EGL spec does not document it as such, for
        // backwards compatibility with older versions of this file.
        case EGL14.EGL_BAD_NATIVE_WINDOW:
        case EGL14.EGL_BAD_SURFACE:
            throw new LegacyExceptionUtils.BufferQueueAbandonedException();

        default:
            throw new IllegalStateException(
                    "swapBuffers: EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 13
Source File: InputSurface.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void checkEglError(String msg) {
    boolean failed = false;
    while (EGL14.eglGetError() != EGL14.EGL_SUCCESS) {
        failed = true;
    }
    if (failed) {
        throw new RuntimeException("EGL error encountered (see log)");
    }
}
 
Example 14
Source File: EGLEnvironment.java    From EZFilter with MIT License 5 votes vote down vote up
private int swap(final EGLSurface surface) {
    if (!EGL14.eglSwapBuffers(mEglDisplay, surface)) {
        final int err = EGL14.eglGetError();
        return err;
    }
    return EGL14.EGL_SUCCESS;
}
 
Example 15
Source File: CameraToMpegTest.java    From Android-MediaCodec-Examples with Apache License 2.0 5 votes vote down vote up
/**
 * Checks for EGL errors.  Throws an exception if one is found.
 */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 16
Source File: EglCore.java    From kickflip-android-sdk with Apache License 2.0 5 votes vote down vote up
/**
 * Checks for EGL errors.
 */
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 17
Source File: EGLBase.java    From AudioVideoPlayerSample with Apache License 2.0 4 votes vote down vote up
private void checkEglError(String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 18
Source File: EGLBase.java    From CameraRecorder-android with MIT License 4 votes vote down vote up
private void checkEglError(final String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 19
Source File: EGLBase.java    From AudioVideoRecordingSample with Apache License 2.0 4 votes vote down vote up
private void checkEglError(final String msg) {
    int error;
    if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) {
        throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error));
    }
}
 
Example 20
Source File: GLSurfaceView2.java    From java6-android-glframework with Mozilla Public License 2.0 4 votes vote down vote up
/**
 * Create an egl surface for the current SurfaceHolder surface. If a surface
 * already exists, destroy it before creating the new surface.
 *
 * @return true if the surface was created successfully.
 */
public boolean createSurface()
{
   if (s_LOG_EGL)
   {
      Log.w("EglHelper", "createSurface()  tid=" + Thread.currentThread().getId());
   }
      /*
       * Check preconditions.
       */
   if (mEglDisplay == null)
   {
      throw new RuntimeException("eglDisplay not initialized");
   }

   if (mEglConfig == null)
   {
      throw new RuntimeException("mEglConfig not initialized");
   }

      /*
       *  The window size has changed, so we need to create a new
       *  surface.
       */
   destroySurfaceImp();

      /*
       * Create an EGL surface we can render into.
       */
   GLSurfaceView2 view = mGLSurfaceViewWeakRef.get();
   if (view != null)
   {
      mEglSurface = view.eglWindowSurfaceFactory.createWindowSurface(mEglDisplay, mEglConfig, view.getHolder());
   }
   else
   {
      mEglSurface = null;
   }

   if (mEglSurface == null || mEglSurface == EGL14.EGL_NO_SURFACE)
   {
      int error = EGL14.eglGetError();
      if (error == EGL14.EGL_BAD_NATIVE_WINDOW)
      {
         Log.e("EglHelper", "createWindowSurface returned EGL_BAD_NATIVE_WINDOW.");
      }
      return false;
   }

   /*
    * Before we can issue GL commands, we need to make sure
    * the context is current and bound to a surface.
    */
   if (!EGL14.eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext))
   {
      /*
       * Could not make the context current, probably because the underlying
       * SurfaceView surface has been destroyed.
       */
      logEglErrorAsWarning("EGLHelper", "eglMakeCurrent", EGL14.eglGetError());
      return false;
   }

   return true;
}