Java Code Examples for javax.microedition.khronos.egl.EGL10#EGL_NO_CONTEXT

The following examples show how to use javax.microedition.khronos.egl.EGL10#EGL_NO_CONTEXT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: EGL.java    From MyHearts with Apache License 2.0 6 votes vote down vote up
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
Example 2
Source File: EGL.java    From react-native-android-vitamio with MIT License 6 votes vote down vote up
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
Example 3
Source File: EGL.java    From video-player with MIT License 6 votes vote down vote up
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
Example 4
Source File: EGL.java    From Vitamio with Apache License 2.0 6 votes vote down vote up
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
Example 5
Source File: EGL.java    From BambooPlayer with Apache License 2.0 6 votes vote down vote up
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
Example 6
Source File: EGL.java    From NetEasyNews with GNU General Public License v3.0 6 votes vote down vote up
public void start() {
  mEgl = (EGL10) EGLContext.getEGL();
  mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

  int[] version = new int[2];
  if (!mEgl.eglInitialize(mEglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  mEglConfig = mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

  mEglContext = mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
  if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
    mEglContext = null;
    throwEglException("createContext");
  }

  mEglSurface = null;
}
 
Example 7
Source File: BlockingGLTextureView.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 */
public void start() {
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if (!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    mEglConfig = chooseEglConfig();

    /*
    * Create an EGL context. We want to do this as rarely as we can, because an
    * EGL context is a somewhat heavy object.
    */
    mEglContext = createContext(mEgl, mEglDisplay, mEglConfig);

    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }

    mEglSurface = null;
}
 
Example 8
Source File: EGLLogWrapper.java    From DanDanPlayForAndroid with MIT License 5 votes vote down vote up
private void arg(String name, EGLContext object) {
    if (object == EGL10.EGL_NO_CONTEXT) {
        arg(name, "EGL10.EGL_NO_CONTEXT");
    } else {
        arg(name, toString(object));
    }
}
 
Example 9
Source File: BlockingGLTextureView.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 */
public void start() {
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if (!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    mEglConfig = chooseEglConfig();

    /*
    * Create an EGL context. We want to do this as rarely as we can, because an
    * EGL context is a somewhat heavy object.
    */
    mEglContext = createContext(mEgl, mEglDisplay, mEglConfig);

    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }

    mEglSurface = null;
}
 
Example 10
Source File: EglBase10.java    From VideoCRE with MIT License 5 votes vote down vote up
@Override
public void release() {
  checkIsNotReleased();
  releaseSurface();
  detachCurrent();
  egl.eglDestroyContext(eglDisplay, eglContext);
  egl.eglTerminate(eglDisplay);
  eglContext = EGL10.EGL_NO_CONTEXT;
  eglDisplay = EGL10.EGL_NO_DISPLAY;
  eglConfig = null;
}
 
Example 11
Source File: EglHelper.java    From android-openGL-canvas with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 * @param eglContext
 */
@Override
public EglContextWrapper start(EglContextWrapper eglContext) {
    FileLogger.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if (!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    mEglConfig = eglConfigChooser.chooseConfig(mEgl, mEglDisplay);

        /*
        * Create an EGL context. We want to do this as rarely as we can, because an
        * EGL context is a somewhat heavy object.
        */
    mEglContext = eglContextFactory.createContext(mEgl, mEglDisplay, mEglConfig, eglContext.getEglContextOld());
    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }
    FileLogger.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());

    mEglSurface = null;

    EglContextWrapper eglContextWrapper = new EglContextWrapper();
    eglContextWrapper.setEglContextOld(mEglContext);
    return eglContextWrapper;
}
 
Example 12
Source File: GLTextureView.java    From VideoRecorder with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 * @param configSpec
 */
public void start() {
    if (LOG_EGL) {
        Log.w("EglHelper", "startRecord() tid=" + Thread.currentThread().getId());
    }
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if(!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    GLTextureView view = mGLTextureViewWeakRef.get();
    if (view == null) {
        mEglConfig = null;
        mEglContext = null;
    } else {
        mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

        /*
        * Create an EGL context. We want to do this as rarely as we can, because an
        * EGL context is a somewhat heavy object.
        */
        mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
    }
    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }
    if (LOG_EGL) {
        Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
    }

    mEglSurface = null;
}
 
Example 13
Source File: EglBase10.java    From UltraGpuImage with MIT License 4 votes vote down vote up
private void checkIsNotReleased() {
  if (eglDisplay == EGL10.EGL_NO_DISPLAY || eglContext == EGL10.EGL_NO_CONTEXT
      || eglConfig == null) {
    throw new RuntimeException("This object has been released");
  }
}
 
Example 14
Source File: EglHelper.java    From DanDanPlayForAndroid with MIT License 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 * @param eglContext
 */
@Override
public EglContextWrapper start(EglContextWrapper eglContext) {
    if (GLThread.LOG_EGL) {
        Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
    }
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if (!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    mEglConfig = eglConfigChooser.chooseConfig(mEgl, mEglDisplay);

        /*
        * Create an EGL context. We want to do this as rarely as we can, because an
        * EGL context is a somewhat heavy object.
        */
    mEglContext = eglContextFactory.createContext(mEgl, mEglDisplay, mEglConfig, eglContext.getEglContextOld());
    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }
    if (GLThread.LOG_EGL) {
        Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
    }

    mEglSurface = null;

    EglContextWrapper eglContextWrapper = new EglContextWrapper();
    eglContextWrapper.setEglContextOld(mEglContext);
    return eglContextWrapper;
}
 
Example 15
Source File: GLTextureView.java    From MD360Player4Android with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 * @param configSpec
 */
public void start() {
    if (LOG_EGL) {
        Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
    }
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if(!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    GLTextureView view = mGLTextureViewWeakRef.get();
    if (view == null) {
        mEglConfig = null;
        mEglContext = null;
    } else {
        mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

        /*
        * Create an EGL context. We want to do this as rarely as we can, because an
        * EGL context is a somewhat heavy object.
        */
        mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
    }
    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }
    if (LOG_EGL) {
        Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
    }

    mEglSurface = null;
}
 
Example 16
Source File: EGLBase10.java    From libcommon with Apache License 2.0 4 votes vote down vote up
/**
 * EGLレンダリングコンテキストが有効かどうか
 * @return
 */
@Override
public boolean isValidContext() {
	return (mContext != null) && (mContext.eglContext != EGL10.EGL_NO_CONTEXT);
}
 
Example 17
Source File: GLSurfaceView.java    From EZFilter with MIT License 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 */
public void start() {
    if (LOG_EGL) {
        Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
    }
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if (!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    GLSurfaceView view = mGLSurfaceViewWeakRef.get();
    if (view == null) {
        mEglConfig = null;
        mEglContext = null;
    } else {
        mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

        /*
        * Create an EGL context. We want to do this as rarely as we can, because an
        * EGL context is a somewhat heavy object.
        */
        mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
    }
    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }
    if (LOG_EGL) {
        Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
    }

    mEglSurface = null;
}
 
Example 18
Source File: GLTextureView.java    From EZFilter with MIT License 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 */
public void start() {
    if (LOG_EGL) {
        Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
    }
    /*
     * Get an EGL instance
     */
    mEgl = (EGL10) EGLContext.getEGL();

    /*
     * Get to the default display.
     */
    mEglDisplay = mEgl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

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

    /*
     * We can now initialize EGL for that display
     */
    int[] version = new int[2];
    if (!mEgl.eglInitialize(mEglDisplay, version)) {
        throw new RuntimeException("eglInitialize failed");
    }
    GLTextureView view = mGLTextureViewWeakRef.get();
    if (view == null) {
        mEglConfig = null;
        mEglContext = null;
    } else {
        mEglConfig = view.mEGLConfigChooser.chooseConfig(mEgl, mEglDisplay);

        /*
        * Create an EGL context. We want to do this as rarely as we can, because an
        * EGL context is a somewhat heavy object.
        */
        mEglContext = view.mEGLContextFactory.createContext(mEgl, mEglDisplay, mEglConfig);
    }
    if (mEglContext == null || mEglContext == EGL10.EGL_NO_CONTEXT) {
        mEglContext = null;
        throwEglException("createContext");
    }
    if (LOG_EGL) {
        Log.w("EglHelper", "createContext " + mEglContext + " tid=" + Thread.currentThread().getId());
    }

    mEglSurface = null;
}
 
Example 19
Source File: EglContextWrapper.java    From android-openGL-canvas with Apache License 2.0 4 votes vote down vote up
public EGLNoContextWrapper() {
    eglContextOld = EGL10.EGL_NO_CONTEXT;
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
        eglContext = EGL14.EGL_NO_CONTEXT;
    }
}
 
Example 20
Source File: GLTextureView.java    From android-RoundedTextureView with Apache License 2.0 4 votes vote down vote up
/**
 * Initialize EGL for a given configuration spec.
 */
public void start() {
  if (LOG_EGL) {
    Log.w("EglHelper", "start() tid=" + Thread.currentThread().getId());
  }
        /*
         * Get an EGL instance
         */
  egl = (EGL10) EGLContext.getEGL();

        /*
         * Get to the default display.
         */
  eglDisplay = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

  if (eglDisplay == EGL10.EGL_NO_DISPLAY) {
    throw new RuntimeException("eglGetDisplay failed");
  }

        /*
         * We can now initialize EGL for that display
         */
  int[] version = new int[2];
  if (!egl.eglInitialize(eglDisplay, version)) {
    throw new RuntimeException("eglInitialize failed");
  }
  GLTextureView view = glTextureViewWeakRef.get();
  if (view == null) {
    eglConfig = null;
    eglContext = null;
  } else {
    eglConfig = view.eglConfigChooser.chooseConfig(egl, eglDisplay);

            /*
            * Create an EGL context. We want to do this as rarely as we can, because an
            * EGL context is a somewhat heavy object.
            */
    eglContext = view.eglContextFactory.createContext(egl, eglDisplay, eglConfig);
  }
  if (eglContext == null || eglContext == EGL10.EGL_NO_CONTEXT) {
    eglContext = null;
    throwEglException("createContext");
  }
  if (LOG_EGL) {
    Log.w("EglHelper",
        "createContext " + eglContext + " tid=" + Thread.currentThread().getId());
  }

  eglSurface = null;
}