当前位置: 首页>>代码示例>>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;未经允许,请勿转载。