Search in sources :

Example 16 with EGL10

use of javax.microedition.khronos.egl.EGL10 in project android_frameworks_base by ParanoidAndroid.

the class ManagedEGLContext method doTerminate.

/** @hide */
public static boolean doTerminate() {
    ArrayList<ManagedEGLContext> active;
    if (Looper.getMainLooper() != Looper.myLooper()) {
        throw new IllegalStateException("Called on wrong thread");
    }
    synchronized (sActive) {
        // try to terminate.
        if (sActive.size() <= 0) {
            return false;
        }
        // Need to check how many EGL contexts are actually running,
        // to compare with how many we are managing.
        EGL10 egl = (EGL10) EGLContext.getEGL();
        EGLDisplay display = egl.eglGetDisplay(EGL_DEFAULT_DISPLAY);
        if (display == EGL_NO_DISPLAY) {
            Log.w(TAG, "doTerminate failed: no display");
            return false;
        }
        if (EGLImpl.getInitCount(display) != sActive.size()) {
            Log.w(TAG, "doTerminate failed: EGL count is " + EGLImpl.getInitCount(display) + " but managed count is " + sActive.size());
            return false;
        }
        active = new ArrayList<ManagedEGLContext>(sActive);
        sActive.clear();
    }
    for (int i = 0; i < active.size(); i++) {
        active.get(i).execTerminate();
    }
    return true;
}
Also used : EGL10(javax.microedition.khronos.egl.EGL10) EGLDisplay(javax.microedition.khronos.egl.EGLDisplay)

Example 17 with EGL10

use of javax.microedition.khronos.egl.EGL10 in project Rajawali by Rajawali.

the class Renderer method hasGLContext.

/**
     * Indicates whether the OpenGL context is still alive or not.
     *
     * @return {@code boolean} True if the OpenGL context is still alive.
     */
public static boolean hasGLContext() {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLContext eglContext = egl.eglGetCurrentContext();
    return eglContext != EGL10.EGL_NO_CONTEXT;
}
Also used : EGL10(javax.microedition.khronos.egl.EGL10) EGLContext(javax.microedition.khronos.egl.EGLContext)

Example 18 with EGL10

use of javax.microedition.khronos.egl.EGL10 in project android_frameworks_base by DirtyUnicorns.

the class RenderTarget method newTarget.

public static RenderTarget newTarget(int width, int height) {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay eglDisplay = createDefaultDisplay(egl);
    EGLConfig eglConfig = chooseEglConfig(egl, eglDisplay);
    EGLContext eglContext = createContext(egl, eglDisplay, eglConfig);
    EGLSurface eglSurface = createSurface(egl, eglDisplay, width, height);
    RenderTarget result = new RenderTarget(eglDisplay, eglContext, eglSurface, 0, true, true);
    result.addReferenceTo(eglSurface);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGL10(javax.microedition.khronos.egl.EGL10) EGLDisplay(javax.microedition.khronos.egl.EGLDisplay) EGLContext(javax.microedition.khronos.egl.EGLContext) EGLConfig(javax.microedition.khronos.egl.EGLConfig)

Example 19 with EGL10

use of javax.microedition.khronos.egl.EGL10 in project android_frameworks_base by ResurrectionRemix.

the class RenderTarget method focusNone.

public static void focusNone() {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    egl.eglMakeCurrent(egl.eglGetCurrentDisplay(), EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
    mCurrentTarget.set(null);
    checkEglError(egl, "eglMakeCurrent");
}
Also used : EGL10(javax.microedition.khronos.egl.EGL10)

Example 20 with EGL10

use of javax.microedition.khronos.egl.EGL10 in project android_frameworks_base by ResurrectionRemix.

the class RenderTarget method newTarget.

public static RenderTarget newTarget(int width, int height) {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay eglDisplay = createDefaultDisplay(egl);
    EGLConfig eglConfig = chooseEglConfig(egl, eglDisplay);
    EGLContext eglContext = createContext(egl, eglDisplay, eglConfig);
    EGLSurface eglSurface = createSurface(egl, eglDisplay, width, height);
    RenderTarget result = new RenderTarget(eglDisplay, eglContext, eglSurface, 0, true, true);
    result.addReferenceTo(eglSurface);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGL10(javax.microedition.khronos.egl.EGL10) EGLDisplay(javax.microedition.khronos.egl.EGLDisplay) EGLContext(javax.microedition.khronos.egl.EGLContext) EGLConfig(javax.microedition.khronos.egl.EGLConfig)

Aggregations

EGL10 (javax.microedition.khronos.egl.EGL10)22 EGLDisplay (javax.microedition.khronos.egl.EGLDisplay)16 EGLConfig (javax.microedition.khronos.egl.EGLConfig)12 EGLContext (javax.microedition.khronos.egl.EGLContext)9 EGLSurface (javax.microedition.khronos.egl.EGLSurface)8 SuppressLint (android.annotation.SuppressLint)1 TargetApi (android.annotation.TargetApi)1 Paint (android.graphics.Paint)1 EGLConfig (android.opengl.EGLConfig)1 TextPaint (android.text.TextPaint)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1 ConfigChooser (org.andengine.opengl.view.ConfigChooser)1 DeviceNotSupportedException (org.andengine.util.exception.DeviceNotSupportedException)1