当前位置: 首页>>代码示例>>Java>>正文


Java EGLContext类代码示例

本文整理汇总了Java中android.opengl.EGLContext的典型用法代码示例。如果您正苦于以下问题:Java EGLContext类的具体用法?Java EGLContext怎么用?Java EGLContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


EGLContext类属于android.opengl包,在下文中一共展示了EGLContext类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createGLESWithPBuffer

import android.opengl.EGLContext; //导入依赖的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

示例2: setEglContext

import android.opengl.EGLContext; //导入依赖的package包/类
public final void setEglContext(final EGLContext shared_context, final int tex_id, final Object surface, final boolean isRecordable) {
	if (DEBUG) Log.i(TAG, "setEglContext:");
	if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture) && !(surface instanceof SurfaceHolder))
		throw new RuntimeException("unsupported window type:" + surface);
	synchronized (mSync) {
		if (mRequestRelease) return;
		mShard_context = shared_context;
		mTexId = tex_id;
		mSurface = surface;
		mIsRecordable = isRecordable;
		mRequestSetEglContext = true;
		mSync.notifyAll();
		try {
			mSync.wait();
		} catch (final InterruptedException e) {
		}
	}
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:19,代码来源:RenderHandler.java

示例3: handleUpdateSharedContext

import android.opengl.EGLContext; //导入依赖的package包/类
/**
 * Tears down the EGL surface and context we've been using to feed the MediaCodec input
 * surface, and replaces it with a new one that shares with the new context.
 * <p>
 * This is useful if the old context we were sharing with went away (maybe a GLSurfaceView
 * that got torn down) and we need to hook up with the new one.
 */
private void handleUpdateSharedContext(EGLContext newSharedContext) {
    Log.d(TAG, "handleUpdatedSharedContext " + newSharedContext);

    // Release the EGLSurface and EGLContext.
    mInputWindowSurface.releaseEglSurface();
    eglDrawer.deInit();

    mEglCore.release();

    // Create a new EGLContext and recreate the window surface.
    mEglCore = new EglCore(newSharedContext, EglCore.FLAG_RECORDABLE);
    mInputWindowSurface.recreate(mEglCore);
    mInputWindowSurface.makeCurrent();

    eglDrawer.init();
    eglDrawer.setViewportSize(encoderConfig.mWidth,encoderConfig.mHeight);
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:25,代码来源:TextureMovieEncoder.java

示例4: prepareEncoder

import android.opengl.EGLContext; //导入依赖的package包/类
private void prepareEncoder(EGLContext sharedContext, int width, int height, int bitRate,
        File outputFile) {
    try {
        MMediaMuxer =new MMediaMuxer(outputFile);
        mVideoEncoder = new VideoEncoderCore(width, height, bitRate, MMediaMuxer);
       // mAudioEncoder = new AudioEncoderCore(MMediaMuxer);
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }
    mEglCore = new EglCore(sharedContext, EglCore.FLAG_RECORDABLE);
    mInputWindowSurface = new WindowSurface(mEglCore, mVideoEncoder.getInputSurface(), true);
    mInputWindowSurface.makeCurrent();

    eglDrawer.init();
    eglDrawer.setViewportSize(encoderConfig.mWidth,encoderConfig.mHeight);
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:17,代码来源:TextureMovieEncoder.java

示例5: testSetPresentationTime

import android.opengl.EGLContext; //导入依赖的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

示例6: testTexture

import android.opengl.EGLContext; //导入依赖的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

示例7: testShader

import android.opengl.EGLContext; //导入依赖的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

示例8: createEglContext

import android.opengl.EGLContext; //导入依赖的package包/类
private static EGLContext createEglContext(
    EglBase14.Context sharedContext, EGLDisplay eglDisplay, EGLConfig eglConfig) {
  if (sharedContext != null && sharedContext.egl14Context == EGL14.EGL_NO_CONTEXT) {
    throw new RuntimeException("Invalid sharedContext");
  }
  int[] contextAttributes = {EGL14.EGL_CONTEXT_CLIENT_VERSION, 2, EGL14.EGL_NONE};
  EGLContext rootContext =
      sharedContext == null ? EGL14.EGL_NO_CONTEXT : sharedContext.egl14Context;
  final EGLContext eglContext;
  synchronized (EglBase.lock) {
    eglContext = EGL14.eglCreateContext(eglDisplay, eglConfig, rootContext, contextAttributes, 0);
  }
  if (eglContext == EGL14.EGL_NO_CONTEXT) {
    throw new RuntimeException(
        "Failed to create EGL context: 0x" + Integer.toHexString(EGL14.eglGetError()));
  }
  return eglContext;
}
 
开发者ID:Piasy,项目名称:AppRTC-Android,代码行数:19,代码来源:EglBase14.java

示例9: handleUpdateSharedContext

import android.opengl.EGLContext; //导入依赖的package包/类
/**
 * Tears down the EGL surface and context we've been using to feed the MediaCodec input
 * surface, and replaces it with a new one that shares with the new context.
 * <p>
 * This is useful if the old context we were sharing with went away (maybe a GLSurfaceView
 * that got torn down) and we need to hook up with the new one.
 */
private void handleUpdateSharedContext(EGLContext newSharedContext) {
    Log.d(TAG, "handleUpdatedSharedContext " + newSharedContext);

    // Release the EGLSurface and EGLContext.
    mInputWindowSurface.releaseEglSurface();
    mFullScreen.release(false);
    mEglCore.release();

    // Create a new EGLContext and recreate the window surface.
    mEglCore = new EglCore(newSharedContext, EglCore.FLAG_RECORDABLE);
    mInputWindowSurface.recreate(mEglCore);
    mInputWindowSurface.makeCurrent();

    // Create new programs and such for the new context.
    mFullScreen = new FullFrameRect(FilterManager.getCameraFilter(mCurrentFilterType, mContext));
}
 
开发者ID:hoanganhtuan95ptit,项目名称:EditPhoto,代码行数:24,代码来源:TextureMovieEncoder.java

示例10: setEglContext

import android.opengl.EGLContext; //导入依赖的package包/类
public final void setEglContext(final EGLContext shared_context, final int tex_id, final Object surface, final boolean isRecordable) {
	if (DEBUG) Log.i(TAG, "setEglContext:");
	if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture) && !(surface instanceof SurfaceHolder))
		throw new RuntimeException("unsupported window type:" + surface);
	synchronized (mSync) {
		if (mRequestRelease) return;
		mShard_context = shared_context;
		mTexId = tex_id;
		mSurface = surface;
		mIsRecordable = isRecordable;
		mRequestSetEglContext = true;
		Matrix.setIdentityM(mMatrix, 0);
		Matrix.setIdentityM(mMatrix, 16);
		mSync.notifyAll();
		try {
			mSync.wait();
		} catch (final InterruptedException e) {
		}
	}
}
 
开发者ID:FacePlusPlus,项目名称:MegviiFacepp-Android-SDK,代码行数:21,代码来源:RenderHandler.java

示例11: handleUpdateSharedContext

import android.opengl.EGLContext; //导入依赖的package包/类
/**
 * Tears down the EGL surface and context we've been using to feed the MediaCodec input
 * surface, and replaces it with a new one that shares with the new context.
 * <p>
 * This is useful if the old context we were sharing with went away (maybe a GLSurfaceView
 * that got torn down) and we need to hook up with the new one.
 */
private void handleUpdateSharedContext(EGLContext newSharedContext) {
    Log.d(TAG, "handleUpdatedSharedContext " + newSharedContext);

    // Release the EGLSurface and EGLContext.
    mInputWindowSurface.releaseEglSurface();
    mInput.destroy();
    mEglCore.release();

    // Create a new EGLContext and recreate the window surface.
    mEglCore = new EglCore(newSharedContext, EglCore.FLAG_RECORDABLE);
    mInputWindowSurface.recreate(mEglCore);
    mInputWindowSurface.makeCurrent();

    // Create new programs and such for the new context.
    mInput = new MagicCameraInputFilter();
    mInput.init();
    filter = MagicFilterFactory.initFilters(type);
    if(filter != null){
        filter.init();
        filter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);
        filter.onDisplaySizeChanged(mVideoWidth, mVideoHeight);
    }
}
 
开发者ID:zpf527,项目名称:EffectCamera,代码行数:31,代码来源:TextureMovieEncoder.java

示例12: prepareEncoder

import android.opengl.EGLContext; //导入依赖的package包/类
private void prepareEncoder(EGLContext sharedContext, int width, int height, int bitRate,
        File outputFile) {
    try {
        mVideoEncoder = new VideoEncoderCore(width, height, bitRate, outputFile);
    } catch (IOException ioe) {
        throw new RuntimeException(ioe);
    }
    mVideoWidth = width;
    mVideoHeight = height;
    mEglCore = new EglCore(sharedContext, EglCore.FLAG_RECORDABLE);
    mInputWindowSurface = new WindowSurface(mEglCore, mVideoEncoder.getInputSurface(), true);
    mInputWindowSurface.makeCurrent();

    mInput = new MagicCameraInputFilter();
    mInput.init();
    filter = MagicFilterFactory.initFilters(type);
    if(filter != null){
        filter.init();
        filter.onInputSizeChanged(mPreviewWidth, mPreviewHeight);
        filter.onDisplaySizeChanged(mVideoWidth, mVideoHeight);
    }
}
 
开发者ID:zpf527,项目名称:EffectCamera,代码行数:23,代码来源:TextureMovieEncoder.java

示例13: WebRtcClient

import android.opengl.EGLContext; //导入依赖的package包/类
public WebRtcClient(RtcListener listener, String host, PeerConnectionParameters params, EGLContext mEGLcontext) {
    mListener = listener;
    pcParams = params;
    // initializeAndroidGlobals的第一个参数需要是activity或者application
    PeerConnectionFactory.initializeAndroidGlobals(App.getInstance(), true, true,
            params.videoCodecHwAcceleration, mEGLcontext);
    factory = new PeerConnectionFactory();
    MessageHandler messageHandler = new MessageHandler();

    try {
        client = IO.socket(host);
    } catch (URISyntaxException e) {
        e.printStackTrace();
    }
    client.on("id", messageHandler.onId);
    client.on("message", messageHandler.onMessage);
    client.connect(); // connect后,服务端会emit一个id信息,返回该客户端的id

    iceServers.add(new PeerConnection.IceServer("stun:23.21.150.121"));
    iceServers.add(new PeerConnection.IceServer("stun:stun.l.google.com:19302"));

    pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveAudio", "true"));
    pcConstraints.mandatory.add(new MediaConstraints.KeyValuePair("OfferToReceiveVideo", "true"));
    pcConstraints.optional.add(new MediaConstraints.KeyValuePair("DtlsSrtpKeyAgreement", "true"));
}
 
开发者ID:inexistence,项目名称:VideoMeeting,代码行数:26,代码来源:WebRtcClient.java

示例14: setEglContext

import android.opengl.EGLContext; //导入依赖的package包/类
public final void setEglContext(EGLContext shared_context, int tex_id, Object surface, boolean isRecordable) {
	if (DEBUG) Log.i(TAG, "setEglContext:");
	if (!(surface instanceof Surface) && !(surface instanceof SurfaceTexture) && !(surface instanceof SurfaceHolder))
		throw new RuntimeException("unsupported window type:" + surface);
	synchronized (mSync) {
		if (mRequestRelease) return;
		mShard_context = shared_context;
		mTexId = tex_id;
		mSurface = surface;
		mIsRecordable = isRecordable;
		mRequestSetEglContext = true;
		mSync.notifyAll();
		try {
			mSync.wait();
		} catch (InterruptedException e) {
		}
	}
}
 
开发者ID:saki4510t,项目名称:TimeLapseRecordingSample,代码行数:19,代码来源:RenderHandler.java

示例15: handleUpdateSharedContext

import android.opengl.EGLContext; //导入依赖的package包/类
/**
 * Tears down the EGL surface and context we've been using to feed the MediaCodec input
 * surface, and replaces it with a new one that shares with the new context.
 * <p>
 * This is useful if the old context we were sharing with went away (maybe a GLSurfaceView
 * that got torn down) and we need to hook up with the new one.
 */
private void handleUpdateSharedContext(EGLContext newSharedContext) {
    Log.d(TAG, "handleUpdatedSharedContext " + newSharedContext);

    // Release the EGLSurface and EGLContext.
    mInputWindowSurface.releaseEglSurface();
    mFullScreen.release(false);
    mEglCore.release();

    // Create a new EGLContext and recreate the window surface.
    mEglCore = new EglCore(newSharedContext, EglCore.FLAG_RECORDABLE);
    mInputWindowSurface.recreate(mEglCore);
    mInputWindowSurface.makeCurrent();

    // Create new programs and such for the new context.
    mFullScreen = new FullFrameRect(
            new Texture2dProgram(Texture2dProgram.ProgramType.TEXTURE_EXT));
}
 
开发者ID:chriszeng87,项目名称:HardwareEncodingTest,代码行数:25,代码来源:TextureMovieEncoder.java


注:本文中的android.opengl.EGLContext类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。