當前位置: 首頁>>代碼示例>>Java>>正文


Java EGLSurface類代碼示例

本文整理匯總了Java中android.opengl.EGLSurface的典型用法代碼示例。如果您正苦於以下問題:Java EGLSurface類的具體用法?Java EGLSurface怎麽用?Java EGLSurface使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


EGLSurface類屬於android.opengl包,在下文中一共展示了EGLSurface類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: SurfaceEncoder

import android.opengl.EGLSurface; //導入依賴的package包/類
public SurfaceEncoder(){
    super.setOnDrawEndListener(new OnDrawEndListener() {
        @Override
        public void onDrawEnd(EGLSurface surface, RenderBean bean) {
            AvLog.d(TAG,"onDrawEnd start-->");
            if(bean.timeStamp!=-1){
                bean.egl.setPresentationTime(surface,bean.timeStamp*1000);
            }else{
                if(startTime==-1){
                    startTime=bean.textureTime;
                }
                bean.egl.setPresentationTime(surface,bean.textureTime-startTime);
            }
            videoEncodeStep(false);
            AvLog.e(TAG,"onDrawEnd end-->");
            if(mListener!=null){
                mListener.onDrawEnd(surface,bean);
            }
        }
    });
}
 
開發者ID:aiyaapp,項目名稱:AAVT,代碼行數:22,代碼來源:SurfaceEncoder.java

示例2: createGLESWithPBuffer

import android.opengl.EGLSurface; //導入依賴的package包/類
public EGLSurface createGLESWithPBuffer(EGLConfigAttrs attrs,EGLContextAttrs ctxAttrs,int width,int height){
    EGLConfig config=getConfig(attrs.surfaceType(EGL14.EGL_PBUFFER_BIT));
    if(config==null){
        log("getConfig failed : "+EGL14.eglGetError());
        return null;
    }
    EGLContext eglContext=createContext(config,EGL14.EGL_NO_CONTEXT,ctxAttrs);
    if(eglContext==EGL14.EGL_NO_CONTEXT){
        log("createContext failed : "+EGL14.eglGetError());
        return null;
    }
    EGLSurface eglSurface=createPBufferSurface(config,width,height);
    if(eglSurface==EGL14.EGL_NO_SURFACE){
        log("createWindowSurface failed : "+EGL14.eglGetError());
        return null;
    }
    if(!EGL14.eglMakeCurrent(mEGLDisplay,eglSurface,eglSurface,eglContext)){
        log("eglMakeCurrent failed : "+EGL14.eglGetError());
        return null;
    }
    return eglSurface;
}
 
開發者ID:aiyaapp,項目名稱:AAVT,代碼行數:23,代碼來源:EglHelper.java

示例3: makeCurrent

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
	 * 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;
	}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:24,代碼來源:EGLBase.java

示例4: testSetPresentationTime

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
 * Test for {@link GLTools#setPresentationTime(EGLDisplay, EGLSurface, long)} .
 * @throws Exception by some fails
 */
@Test
public final void testSetPresentationTime() throws Exception {
    final EGLDisplay eglDisplay = GLTools.newDisplay();
    final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
    final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
    final EGLSurface eglSurface =
            GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);
    GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);

    final int txt = GLTools.newTexture(TEXTURE_LEVEL);
    final SurfaceTexture surfaceTexture = new SurfaceTexture(txt, true);
    final Surface surface = new Surface(surfaceTexture);
    final EGLSurface window = GLTools.newSurface(eglDisplay, eglConfig, surface);

    GLTools.setPresentationTime(eglDisplay, window, PRESENTATION_TIME);

    GLTools.closeSurface(eglDisplay, window);
    surface.release();
    surfaceTexture.release();
    GLTools.closeTexture(txt, TEXTURE_LEVEL);

    GLTools.closeSurface(eglDisplay, eglSurface);
    GLTools.closeContext(eglDisplay, eglContext);
    GLTools.closeDisplay(eglDisplay);
}
 
開發者ID:Nik-Gleb,項目名稱:mpeg-encoder,代碼行數:30,代碼來源:GLToolsAndroidTest.java

示例5: testTexture

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
 * Test for {@link GLTools#newTexture(int)} and {@link GLTools#closeTexture(int, int)}.
 * @throws Exception by some fails
 */
@Test
public final void testTexture() throws Exception {
    final EGLDisplay eglDisplay = GLTools.newDisplay();
    final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
    final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
    final EGLSurface eglSurface =
            GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);

    GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);

    GLTools.closeTexture(GLTools.newTexture(TEXTURE_LEVEL), TEXTURE_LEVEL);

    GLTools.closeSurface(eglDisplay, eglSurface);
    GLTools.closeContext(eglDisplay, eglContext);
    GLTools.closeDisplay(eglDisplay);
}
 
開發者ID:Nik-Gleb,項目名稱:mpeg-encoder,代碼行數:21,代碼來源:GLToolsAndroidTest.java

示例6: testShader

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
 * Test for {@link GLTools#newShader(int[])} and {@link GLTools#closeShader(int[])}.
 * @throws Exception by some fails
 */
@Test
public final void testShader() throws Exception {
    final EGLDisplay eglDisplay = GLTools.newDisplay();
    final EGLConfig eglConfig = GLTools.newConfig(eglDisplay, true);
    final EGLContext eglContext = GLTools.newContext(eglDisplay, eglConfig);
    final EGLSurface eglSurface =
            GLTools.newSurface(eglDisplay, eglConfig, FRAME_SIZE, FRAME_SIZE);

    GLTools.makeCurrent(eglDisplay, eglSurface, eglContext);

    final int[] attrs = new int[5];
    GLTools.newShader(attrs);
    GLTools.closeShader(attrs);

    GLTools.closeSurface(eglDisplay, eglSurface);
    GLTools.closeContext(eglDisplay, eglContext);
    GLTools.closeDisplay(eglDisplay);
}
 
開發者ID:Nik-Gleb,項目名稱:mpeg-encoder,代碼行數:23,代碼來源:GLToolsAndroidTest.java

示例7: createWindowSurface

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
 * Creates an EGL surface associated with a Surface.
 * <p>
 * If this is destined for MediaCodec, the EGLConfig should have the "recordable" attribute.
 */
public EGLSurface createWindowSurface(Object surface) {
    if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) {
        throw new RuntimeException("invalid surface: " + surface);
    }

    // Create a window surface, and attach it to the Surface we received.
    int[] surfaceAttribs = {
            EGL14.EGL_NONE
    };
    EGLSurface eglSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surface,
            surfaceAttribs, 0);
    checkEglError("eglCreateWindowSurface");
    if (eglSurface == null) {
        throw new RuntimeException("surface was null");
    }
    return eglSurface;
}
 
開發者ID:AndyZhu1991,項目名稱:grafika,代碼行數:23,代碼來源:EglCore.java

示例8: createEGLSurface

import android.opengl.EGLSurface; //導入依賴的package包/類
public EGLSurface createEGLSurface(Object surface) {

        if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture)) {
            throw new RuntimeException("invalid surface: " + surface);
        }

        // Create a window surface, and attach it to the Surface we received.
        int[] surfaceAttributes = {
                EGL14.EGL_NONE
        };
        EGLSurface eglSurface = EGL14.eglCreateWindowSurface(mEGLDisplay, mEGLConfig, surface,
                surfaceAttributes, 0);
        if (eglSurface == null) {
            throw new RuntimeException("surface was null");
        }

        return eglSurface;
    }
 
開發者ID:LeonHover,項目名稱:MediaCodecRecorder,代碼行數:19,代碼來源:GLContext.java

示例9: cameraInit

import android.opengl.EGLSurface; //導入依賴的package包/類
private void cameraInit(){
    mShower=new SurfaceShower();
    mProvider=new CameraProvider();
    mProcessor=new VideoSurfaceProcessor();
    mProcessor.setTextureProvider(mProvider);
    mProcessor.addObserver(mShower);
    mFb=new FrameBuffer();
    mShower.setOnDrawEndListener(new SurfaceShower.OnDrawEndListener() {
        @Override
        public void onDrawEnd(EGLSurface surface, RenderBean bean) {
            if(exportFlag){
                if(mOutputFilter==null){
                    mOutputFilter=new YuvOutputFilter(YuvOutputFilter.EXPORT_TYPE_NV21);
                    mOutputFilter.create();
                    mOutputFilter.sizeChanged(picX,picY);
                    mOutputFilter.setInputTextureSize(bean.sourceWidth,bean.sourceHeight);
                    tempBuffer=new byte[picX*picY*3/2];
                }

                mOutputFilter.drawToTexture(bean.textureId);
                mOutputFilter.getOutput(tempBuffer,0,picX*picY*3/2);
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        if(mBitmap!=null){
                            mBitmap.recycle();
                            mBitmap=null;
                        }
                        mBitmap=rawByteArray2RGBABitmap2(tempBuffer,picX,picY);
                        mImage.setImageBitmap(mBitmap);
                        mImage.setVisibility(View.VISIBLE);
                    }
                });
                exportFlag=false;
            }
        }
    });
}
 
開發者ID:aiyaapp,項目名稱:AAVT,代碼行數:39,代碼來源:YuvExportActivity.java

示例10: logCurrent

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
 * Writes the current display, context, and surface to the log.
 */
public static void logCurrent(String msg) {
    EGLDisplay display;
    EGLContext context;
    EGLSurface surface;

    display = EGL14.eglGetCurrentDisplay();
    context = EGL14.eglGetCurrentContext();
    surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW);
    Log.i(TAG, "Current EGL (" + msg + "): display=" + display + ", context=" + context +
            ", surface=" + surface);
}
 
開發者ID:vipycm,項目名稱:mao-android,代碼行數:15,代碼來源:EglCore.java

示例11: destroyGLES

import android.opengl.EGLSurface; //導入依賴的package包/類
public boolean destroyGLES(EGLSurface surface,EGLContext context){
    EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
    if(surface!=null){
        EGL14.eglDestroySurface(mEGLDisplay,surface);
    }
    if(context!=null){
        EGL14.eglDestroyContext(mEGLDisplay,context);
    }
    EGL14.eglTerminate(mEGLDisplay);
    log("gl destroy gles");
    return true;
}
 
開發者ID:aiyaapp,項目名稱:AAVT,代碼行數:13,代碼來源:EglHelper.java

示例12: swap

import android.opengl.EGLSurface; //導入依賴的package包/類
private int swap(final EGLSurface surface) {
//		if (DEBUG) Log.v(TAG, "swap:");
        if (!EGL14.eglSwapBuffers(mEglDisplay, surface)) {
        	final int err = EGL14.eglGetError();
        	if (DEBUG) Log.w(TAG, "swap:err=" + err);
            return err;
        }
        return EGL14.EGL_SUCCESS;
    }
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:10,代碼來源:EGLBase.java

示例13: createWindowSurface

import android.opengl.EGLSurface; //導入依賴的package包/類
private EGLSurface createWindowSurface(final Object nativeWindow) {
	if (DEBUG) Log.v(TAG, "createWindowSurface:nativeWindow=" + nativeWindow);

       final int[] surfaceAttribs = {
               EGL14.EGL_NONE
       };
	EGLSurface result = null;
	try {
		result = EGL14.eglCreateWindowSurface(mEglDisplay, mEglConfig, nativeWindow, surfaceAttribs, 0);
	} catch (final IllegalArgumentException e) {
		Log.e(TAG, "eglCreateWindowSurface", e);
	}
	return result;
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:15,代碼來源:EGLBase.java

示例14: destroyWindowSurface

import android.opengl.EGLSurface; //導入依賴的package包/類
private void destroyWindowSurface(EGLSurface surface) {
	if (DEBUG) Log.v(TAG, "destroySurface:");

       if (surface != EGL14.EGL_NO_SURFACE) {
       	EGL14.eglMakeCurrent(mEglDisplay,
       		EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT);
       	EGL14.eglDestroySurface(mEglDisplay, surface);
       }
       surface = EGL14.EGL_NO_SURFACE;
       if (DEBUG) Log.v(TAG, "destroySurface:finished");
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:12,代碼來源:EGLBase.java

示例15: createOffscreenSurface

import android.opengl.EGLSurface; //導入依賴的package包/類
/**
 * Creates an EGL surface associated with an offscreen buffer.
 */
public EGLSurface createOffscreenSurface(int width, int height) {
    int[] surfaceAttribs = {
            EGL14.EGL_WIDTH, width,
            EGL14.EGL_HEIGHT, height,
            EGL14.EGL_NONE
    };
    EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig,
            surfaceAttribs, 0);
    checkEglError("eglCreatePbufferSurface");
    if (eglSurface == null) {
        throw new RuntimeException("surface was null");
    }
    return eglSurface;
}
 
開發者ID:zhangyaqiang,項目名稱:Fatigue-Detection,代碼行數:18,代碼來源:EglCore.java


注:本文中的android.opengl.EGLSurface類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。