FileDocCategorySizeDatePackage
GLEnvironment.javaAPI DocAndroid 5.1 API5528Thu Mar 12 22:22:30 GMT 2015android.filterfw.core

GLEnvironment

public class GLEnvironment extends Object
hide

Fields Summary
private int
glEnvId
private boolean
mManageContext
Constructors Summary
public GLEnvironment()


      
        nativeAllocate();
    
private GLEnvironment(android.filterfw.core.NativeAllocatorTag tag)

    
Methods Summary
public voidactivate()

        if (Looper.myLooper() != null && Looper.myLooper().equals(Looper.getMainLooper())) {
            Log.e("FilterFramework", "Activating GL context in UI thread!");
        }
        if (mManageContext && !nativeActivate()) {
            throw new RuntimeException("Could not activate GLEnvironment!");
        }
    
public voidactivateSurfaceWithId(int surfaceId)

        if (!nativeActivateSurfaceId(surfaceId)) {
            throw new RuntimeException("Could not activate surface " + surfaceId + "!");
        }
    
public voiddeactivate()

        if (mManageContext && !nativeDeactivate()) {
            throw new RuntimeException("Could not deactivate GLEnvironment!");
        }
    
protected voidfinalize()

        tearDown();
    
public voidinitWithCurrentContext()

        mManageContext = false;
        if (!nativeInitWithCurrentContext()) {
            throw new RuntimeException("Could not initialize GLEnvironment with current context!");
        }
    
public voidinitWithNewContext()

        mManageContext = true;
        if (!nativeInitWithNewContext()) {
            throw new RuntimeException("Could not initialize GLEnvironment with new context!");
        }
    
public booleanisActive()

        return nativeIsActive();
    
public static booleanisAnyContextActive()

        return nativeIsAnyContextActive();
    
public booleanisContextActive()

        return nativeIsContextActive();
    
private native booleannativeActivate()

private native booleannativeActivateSurfaceId(int surfaceId)

private native intnativeAddSurface(android.view.Surface surface)

private native intnativeAddSurfaceFromMediaRecorder(android.media.MediaRecorder mediaRecorder)

private native intnativeAddSurfaceWidthHeight(android.view.Surface surface, int width, int height)

private native booleannativeAllocate()

private native booleannativeDeactivate()

private native booleannativeDeallocate()

private native booleannativeDisconnectSurfaceMediaSource(android.media.MediaRecorder mediaRecorder)

private native booleannativeInitWithCurrentContext()

private native booleannativeInitWithNewContext()

private native booleannativeIsActive()

private static native booleannativeIsAnyContextActive()

private native booleannativeIsContextActive()

private native booleannativeRemoveSurfaceId(int surfaceId)

private native booleannativeSetSurfaceTimestamp(long timestamp)

private native booleannativeSwapBuffers()

public intregisterSurface(android.view.Surface surface)

        int result = nativeAddSurface(surface);
        if (result < 0) {
            throw new RuntimeException("Error registering surface " + surface + "!");
        }
        return result;
    
public intregisterSurfaceFromMediaRecorder(android.media.MediaRecorder mediaRecorder)

        int result = nativeAddSurfaceFromMediaRecorder(mediaRecorder);
        if (result < 0) {
            throw new RuntimeException("Error registering surface from "
                                    + "MediaRecorder" + mediaRecorder + "!");
        }
        return result;
    
public intregisterSurfaceTexture(android.graphics.SurfaceTexture surfaceTexture, int width, int height)

        Surface surface = new Surface(surfaceTexture);
        int result = nativeAddSurfaceWidthHeight(surface, width, height);
        surface.release();
        if (result < 0) {
            throw new RuntimeException("Error registering surfaceTexture " + surfaceTexture + "!");
        }
        return result;
    
public voidsetSurfaceTimestamp(long timestamp)

        if (!nativeSetSurfaceTimestamp(timestamp)) {
            throw new RuntimeException("Could not set timestamp for current surface!");
        }
    
public voidswapBuffers()

        if (!nativeSwapBuffers()) {
            throw new RuntimeException("Error swapping EGL buffers!");
        }
    
public synchronized voidtearDown()

        if (glEnvId != -1) {
            nativeDeallocate();
            glEnvId = -1;
        }
    
public voidunregisterSurfaceId(int surfaceId)

        if (!nativeRemoveSurfaceId(surfaceId)) {
            throw new RuntimeException("Could not unregister surface " + surfaceId + "!");
        }