Search in sources :

Example 11 with EGLConfig

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

the class RenderTarget method createSurface.

private static EGLSurface createSurface(EGL10 egl, EGLDisplay display, int width, int height) {
    EGLConfig eglConfig = chooseEglConfig(egl, display);
    int[] attribs = { EGL10.EGL_WIDTH, width, EGL10.EGL_HEIGHT, height, EGL10.EGL_NONE };
    return egl.eglCreatePbufferSurface(display, eglConfig, attribs);
}
Also used : EGLConfig(javax.microedition.khronos.egl.EGLConfig)

Example 12 with EGLConfig

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

the class RenderTarget method forSurfaceTexture.

@TargetApi(11)
public RenderTarget forSurfaceTexture(SurfaceTexture surfaceTexture) {
    EGLConfig eglConfig = chooseEglConfig(mEgl, mDisplay);
    EGLSurface eglSurf = null;
    synchronized (mSurfaceSources) {
        eglSurf = mSurfaceSources.get(surfaceTexture);
        if (eglSurf == null) {
            eglSurf = mEgl.eglCreateWindowSurface(mDisplay, eglConfig, surfaceTexture, null);
            mSurfaceSources.put(surfaceTexture, eglSurf);
        }
    }
    checkEglError(mEgl, "eglCreateWindowSurface");
    checkSurface(mEgl, eglSurf);
    RenderTarget result = new RenderTarget(mDisplay, mContext, eglSurf, 0, false, true);
    result.setSurfaceSource(surfaceTexture);
    result.addReferenceTo(eglSurf);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGLConfig(javax.microedition.khronos.egl.EGLConfig) TargetApi(android.annotation.TargetApi)

Example 13 with EGLConfig

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

the class RenderTarget method forSurface.

@TargetApi(11)
public RenderTarget forSurface(Surface surface) {
    EGLConfig eglConfig = chooseEglConfig(mEgl, mDisplay);
    EGLSurface eglSurf = null;
    synchronized (mSurfaceSources) {
        eglSurf = mSurfaceSources.get(surface);
        if (eglSurf == null) {
            eglSurf = mEgl.eglCreateWindowSurface(mDisplay, eglConfig, surface, null);
            mSurfaceSources.put(surface, eglSurf);
        }
    }
    checkEglError(mEgl, "eglCreateWindowSurface");
    checkSurface(mEgl, eglSurf);
    RenderTarget result = new RenderTarget(mDisplay, mContext, eglSurf, 0, false, true);
    result.setSurfaceSource(surface);
    result.addReferenceTo(eglSurf);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGLConfig(javax.microedition.khronos.egl.EGLConfig) TargetApi(android.annotation.TargetApi)

Example 14 with EGLConfig

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

the class RenderTarget method forSurfaceHolder.

public RenderTarget forSurfaceHolder(SurfaceHolder surfaceHolder) {
    EGLConfig eglConfig = chooseEglConfig(mEgl, mDisplay);
    EGLSurface eglSurf = null;
    synchronized (mSurfaceSources) {
        eglSurf = mSurfaceSources.get(surfaceHolder);
        if (eglSurf == null) {
            eglSurf = mEgl.eglCreateWindowSurface(mDisplay, eglConfig, surfaceHolder, null);
            mSurfaceSources.put(surfaceHolder, eglSurf);
        }
    }
    checkEglError(mEgl, "eglCreateWindowSurface");
    checkSurface(mEgl, eglSurf);
    RenderTarget result = new RenderTarget(mDisplay, mContext, eglSurf, 0, false, true);
    result.addReferenceTo(eglSurf);
    result.setSurfaceSource(surfaceHolder);
    return result;
}
Also used : EGLSurface(javax.microedition.khronos.egl.EGLSurface) EGLConfig(javax.microedition.khronos.egl.EGLConfig)

Example 15 with EGLConfig

use of javax.microedition.khronos.egl.EGLConfig in project react-native-android-video-editor by RZulfikri.

the class TextureSurfaceRenderer method initGL.

private void initGL() {
    egl = (EGL10) EGLContext.getEGL();
    eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
    int[] version = new int[2];
    egl.eglInitialize(eglDisplay, version);
    EGLConfig eglConfig = chooseEglConfig();
    eglContext = createContext(egl, eglDisplay, eglConfig);
    eglSurface = egl.eglCreateWindowSurface(eglDisplay, eglConfig, texture, null);
    if (eglSurface == null || eglSurface == EGL10.EGL_NO_SURFACE) {
        throw new RuntimeException("GL Error: " + GLUtils.getEGLErrorString(egl.eglGetError()));
    }
    if (!egl.eglMakeCurrent(eglDisplay, eglSurface, eglSurface, eglContext)) {
        throw new RuntimeException("GL Make current error: " + GLUtils.getEGLErrorString(egl.eglGetError()));
    }
}
Also used : EGLConfig(javax.microedition.khronos.egl.EGLConfig)

Aggregations

EGLConfig (javax.microedition.khronos.egl.EGLConfig)42 EGLSurface (javax.microedition.khronos.egl.EGLSurface)20 EGL10 (javax.microedition.khronos.egl.EGL10)12 EGLDisplay (javax.microedition.khronos.egl.EGLDisplay)12 TargetApi (android.annotation.TargetApi)9 EGLContext (javax.microedition.khronos.egl.EGLContext)8 SuppressLint (android.annotation.SuppressLint)1 Paint (android.graphics.Paint)1 TextPaint (android.text.TextPaint)1 FileNotFoundException (java.io.FileNotFoundException)1 IOException (java.io.IOException)1