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


Java EGL14.EGL_NO_CONTEXT属性代码示例

本文整理汇总了Java中android.opengl.EGL14.EGL_NO_CONTEXT属性的典型用法代码示例。如果您正苦于以下问题:Java EGL14.EGL_NO_CONTEXT属性的具体用法?Java EGL14.EGL_NO_CONTEXT怎么用?Java EGL14.EGL_NO_CONTEXT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在android.opengl.EGL14的用法示例。


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

示例1: createGLESWithSurface

public boolean createGLESWithSurface(EGLConfigAttrs attrs,EGLContextAttrs ctxAttrs,Object surface){
    EGLConfig config=getConfig(attrs.surfaceType(EGL14.EGL_WINDOW_BIT).makeDefault(true));
    if(config==null){
        log("getConfig failed : "+EGL14.eglGetError());
        return false;
    }
    mEGLContext=createContext(config,EGL14.EGL_NO_CONTEXT,ctxAttrs.makeDefault(true));
    if(mEGLContext==EGL14.EGL_NO_CONTEXT){
        log("createContext failed : "+EGL14.eglGetError());
        return false;
    }
    mEGLSurface=createWindowSurface(surface);
    if(mEGLSurface==EGL14.EGL_NO_SURFACE){
        log("createWindowSurface failed : "+EGL14.eglGetError());
        return false;
    }
    if(!EGL14.eglMakeCurrent(mEGLDisplay,mEGLSurface,mEGLSurface,mEGLContext)){
        log("eglMakeCurrent failed : "+EGL14.eglGetError());
        return false;
    }
    return true;
}
 
开发者ID:aiyaapp,项目名称:AAVT,代码行数:22,代码来源:EglHelper.java

示例2: createGLESWithPBuffer

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,代码行数:22,代码来源:EglHelper.java

示例3: release

/**
 * Discards all resources held by this class, notably the EGL context.  This must be
 * called from the thread where the context was created.
 * <p>
 * On completion, no context will be current.
 */
public void release() {
    if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) {
        // Android is unusual in that it uses a reference-counted EGLDisplay.  So for
        // every eglInitialize() we need an eglTerminate().
        EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
                EGL14.EGL_NO_CONTEXT);
        EGL14.eglDestroyContext(mEGLDisplay, mEGLContext);
        EGL14.eglReleaseThread();
        EGL14.eglTerminate(mEGLDisplay);
    }

    mEGLDisplay = EGL14.EGL_NO_DISPLAY;
    mEGLContext = EGL14.EGL_NO_CONTEXT;
    mEGLConfig = null;
}
 
开发者ID:vipycm,项目名称:mao-android,代码行数:21,代码来源:EglCore.java

示例4: destroyContext

private void destroyContext() {
if (DEBUG) Log.v(TAG, "destroyContext:");

      if (!EGL14.eglDestroyContext(mEglDisplay, mEglContext)) {
          Log.e("destroyContext", "display:" + mEglDisplay + " context: " + mEglContext);
          Log.e(TAG, "eglDestroyContex:" + EGL14.eglGetError());
      }
      mEglContext = EGL14.EGL_NO_CONTEXT;
      if (mDefaultContext != EGL14.EGL_NO_CONTEXT) {
       if (!EGL14.eglDestroyContext(mEglDisplay, mDefaultContext)) {
           Log.e("destroyContext", "display:" + mEglDisplay + " context: " + mDefaultContext);
           Log.e(TAG, "eglDestroyContex:" + EGL14.eglGetError());
       }
       mDefaultContext = EGL14.EGL_NO_CONTEXT;
      }
  }
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:16,代码来源:EGLBase.java

示例5: createEglContext

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:lgyjg,项目名称:AndroidRTC,代码行数:18,代码来源:EglBase14.java

示例6: destroyContext

private void destroyContext() {
    if (!EGL14.eglDestroyContext(mEglDisplay, mEglContext)) {
        Log.e("destroyContext", "display:" + mEglDisplay + " context: " + mEglContext);
        Log.e(TAG, "eglDestroyContex:" + EGL14.eglGetError());
    }
    mEglContext = EGL14.EGL_NO_CONTEXT;
    if (mDefaultContext != EGL14.EGL_NO_CONTEXT) {
        if (!EGL14.eglDestroyContext(mEglDisplay, mDefaultContext)) {
            Log.e("destroyContext", "display:" + mEglDisplay + " context: " + mDefaultContext);
            Log.e(TAG, "eglDestroyContex:" + EGL14.eglGetError());
        }
        mDefaultContext = EGL14.EGL_NO_CONTEXT;
    }
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:14,代码来源:EGLEnvironment.java

示例7: init

private void init(EGLContext shared_context, final boolean with_depth_buffer, final boolean isRecordable) {
	if (DEBUG) Log.v(TAG, "init:");
       if (mEglDisplay != EGL14.EGL_NO_DISPLAY) {
           throw new RuntimeException("EGL already set up");
       }

       mEglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
       if (mEglDisplay == EGL14.EGL_NO_DISPLAY) {
           throw new RuntimeException("eglGetDisplay failed");
       }

	final int[] version = new int[2];
       if (!EGL14.eglInitialize(mEglDisplay, version, 0, version, 1)) {
       	mEglDisplay = null;
           throw new RuntimeException("eglInitialize failed");
       }

	shared_context = shared_context != null ? shared_context : EGL14.EGL_NO_CONTEXT;
       if (mEglContext == EGL14.EGL_NO_CONTEXT) {
           mEglConfig = getConfig(with_depth_buffer, isRecordable);
           if (mEglConfig == null) {
               throw new RuntimeException("chooseConfig failed");
           }
           // create EGL rendering context
        mEglContext = createContext(shared_context);
       }
       // confirm whether the EGL rendering context is successfully created
       final int[] values = new int[1];
       EGL14.eglQueryContext(mEglDisplay, mEglContext, EGL14.EGL_CONTEXT_CLIENT_VERSION, values, 0);
       if (DEBUG) Log.d(TAG, "EGLContext created, client version " + values[0]);
       makeDefault();	// makeCurrent(EGL14.EGL_NO_SURFACE);
}
 
开发者ID:zhangyaqiang,项目名称:Fatigue-Detection,代码行数:32,代码来源:EGLBase.java

示例8: release

public void release() {
if (DEBUG) Log.v(TAG, "release:");
      if (mEglDisplay != EGL14.EGL_NO_DISPLAY) {
   	destroyContext();
       EGL14.eglTerminate(mEglDisplay);
       EGL14.eglReleaseThread();
      }
      mEglDisplay = EGL14.EGL_NO_DISPLAY;
      mEglContext = EGL14.EGL_NO_CONTEXT;
  }
 
开发者ID:FacePlusPlus,项目名称:MegviiFacepp-Android-SDK,代码行数:10,代码来源:EGLBase.java

示例9: release

private void release() {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        mEGLContext = EGL14.EGL_NO_CONTEXT;
    }

    mState.set(STATE_RELEASED);
    synchronized (mRenderListenerLock) {
        Iterator<GLRender.GLRenderListener> it = mGLRenderListenerList.iterator();

        while (it.hasNext()) {
            GLRenderListener listener = it.next();
            listener.onReleased();
        }
    }
}
 
开发者ID:AgoraIO,项目名称:Agora-Screen-Sharing-Android,代码行数:15,代码来源:GLRender.java

示例10: release

/**
 * Discards all resources held by this class, notably the EGL context.
 */
public void release() {
  if (eglDisplay != EGL14.EGL_NO_DISPLAY) {
    EGL14.eglMakeCurrent(eglDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE,
        EGL14.EGL_NO_CONTEXT);
    EGL14.eglDestroySurface(eglDisplay, eglSurface);
    EGL14.eglDestroyContext(eglDisplay, eglContext);
    EGL14.eglReleaseThread();
    EGL14.eglTerminate(eglDisplay);
  }
  eglDisplay = EGL14.EGL_NO_DISPLAY;
  eglContext = EGL14.EGL_NO_CONTEXT;
  eglSurface = EGL14.EGL_NO_SURFACE;
}
 
开发者ID:pedroSG94,项目名称:rtmp-rtsp-stream-client-java,代码行数:16,代码来源:SurfaceManager.java

示例11: init

private void init(EGLContext sharedContext, final boolean withDepthBuffer) {
    if (mEglDisplay != EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("EGL already set up");
    }

    mEglDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
    if (mEglDisplay == EGL14.EGL_NO_DISPLAY) {
        throw new RuntimeException("eglGetDisplay failed");
    }

    final int[] version = new int[2];
    if (!EGL14.eglInitialize(mEglDisplay, version, 0, version, 1)) {
        mEglDisplay = null;
        throw new RuntimeException("eglInitialize failed");
    }

    sharedContext = sharedContext != null ? sharedContext : EGL14.EGL_NO_CONTEXT;
    if (mEglContext == EGL14.EGL_NO_CONTEXT) {
        mEglConfig = getConfig(withDepthBuffer);
        if (mEglConfig == null) {
            throw new RuntimeException("chooseConfig failed");
        }
        // create EGL rendering context
        mEglContext = createContext(sharedContext);
    }
    // confirm whether the EGL rendering context is successfully created
    final int[] values = new int[1];
    EGL14.eglQueryContext(mEglDisplay, mEglContext, EGL14.EGL_CONTEXT_CLIENT_VERSION, values, 0);
    makeDefault();
}
 
开发者ID:uestccokey,项目名称:EZFilter,代码行数:30,代码来源:EGLEnvironment.java

示例12: checkIsNotReleased

private void checkIsNotReleased() {
  if (eglDisplay == EGL14.EGL_NO_DISPLAY || eglContext == EGL14.EGL_NO_CONTEXT
      || eglConfig == null) {
    throw new RuntimeException("This object has been released");
  }
}
 
开发者ID:Piasy,项目名称:VideoCRE,代码行数:6,代码来源:EglBase14.java

示例13: GLContext

public GLContext(EGLContext eglContext) {
        if (this.mEGLDisplay != EGL14.EGL_NO_DISPLAY) {
            throw new RuntimeException("EGL already set up");
        }

        if (eglContext == null) {
            eglContext = EGL14.EGL_NO_CONTEXT;
        }

        mEGLDisplay = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
        if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) {
            throw new RuntimeException("unable to get EGL14 display");
        }

        int[] version = new int[2];
        if (!EGL14.eglInitialize(mEGLDisplay, version, 0, version, 1)) {
            mEGLDisplay = null;
            throw new RuntimeException("unable to initialize EGL14");
        }

        int[] configAttributes = {
                EGL14.EGL_RED_SIZE, 8,
                EGL14.EGL_GREEN_SIZE, 8,
                EGL14.EGL_BLUE_SIZE, 8,
                EGL14.EGL_ALPHA_SIZE, 8,
//                EGL14.EGL_DEPTH_SIZE, 16,
//                EGL14.EGL_STENCIL_SIZE, 8,
                EGL14.EGL_RENDERABLE_TYPE, EGL14.EGL_OPENGL_ES2_BIT,
                EGL_RECORDABLE_ANDROID, 1,
                EGL14.EGL_NONE
        };


        EGLConfig[] elgConfigs = new EGLConfig[1];
        int[] numConfigs = new int[1];
        if (!EGL14.eglChooseConfig(mEGLDisplay, configAttributes, 0, elgConfigs, 0, elgConfigs.length, numConfigs, 0)) {
            throw new RuntimeException("Unable to find a suitable EGLConfig");
        }
        mEGLConfig = elgConfigs[0];

        int[] contextAttributes = {
                EGL14.EGL_CONTEXT_CLIENT_VERSION, 2,
                EGL14.EGL_NONE
        };

        mEGLContext = EGL14.eglCreateContext(mEGLDisplay, mEGLConfig, eglContext, contextAttributes, 0);
    }
 
开发者ID:LeonHover,项目名称:MediaCodecRecorder,代码行数:47,代码来源:GLContext.java


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