コード例 #1
0
 public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
   if (!egl.eglDestroyContext(display, context)) {
     Log.e("DefaultContextFactory", "display:" + display + " context: " + context);
     if (LOG_THREADS) {
       Log.i("DefaultContextFactory", "tid=" + Thread.currentThread().getId());
     }
     throw new RuntimeException("eglDestroyContext failed: ");
   }
 }
コード例 #2
0
  public boolean eglDestroyContext(EGLDisplay display, EGLContext context) {
    begin("eglDestroyContext");
    arg("display", display);
    arg("context", context);
    end();

    boolean result = mEgl10.eglDestroyContext(display, context);
    returns(result);
    checkError();
    return result;
  }
コード例 #3
0
ファイル: GLLayer.java プロジェクト: bronsen/c-beam-droid
  public void surfaceDestroyed(SurfaceHolder arg0) {
    if (running) {
      running = false;
      this.newFrameLock.setValue(true);
      try {
        mainLoop.join();
      } catch (Exception ex) {
      }
      mainLoop = null;

      egl.eglMakeCurrent(dpy, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
      egl.eglDestroySurface(dpy, surface);
      egl.eglDestroyContext(dpy, eglContext);
      egl.eglTerminate(dpy);
    }
  }
コード例 #4
0
ファイル: SDLActivity.java プロジェクト: Tkachov/Square
  public static void deleteGLContext() {
    if (SDLActivity.mEGLDisplay != null && SDLActivity.mEGLContext != EGL10.EGL_NO_CONTEXT) {
      EGL10 egl = (EGL10) EGLContext.getEGL();
      egl.eglMakeCurrent(
          SDLActivity.mEGLDisplay,
          EGL10.EGL_NO_SURFACE,
          EGL10.EGL_NO_SURFACE,
          EGL10.EGL_NO_CONTEXT);
      egl.eglDestroyContext(SDLActivity.mEGLDisplay, SDLActivity.mEGLContext);
      SDLActivity.mEGLContext = EGL10.EGL_NO_CONTEXT;

      if (SDLActivity.mEGLSurface != EGL10.EGL_NO_SURFACE) {
        egl.eglDestroySurface(SDLActivity.mEGLDisplay, SDLActivity.mEGLSurface);
        SDLActivity.mEGLSurface = EGL10.EGL_NO_SURFACE;
      }
    }
  }
コード例 #5
0
ファイル: YabauseView.java プロジェクト: GPDP2/yabause
  private void endGLES() {
    EGL10 egl = (EGL10) EGLContext.getEGL();
    if (mEglSurface != null) {
      // レンダリングコンテキストとの結びつけは解除
      egl.eglMakeCurrent(
          mEglDisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);

      egl.eglDestroySurface(mEglDisplay, mEglSurface);
      mEglSurface = null;
    }

    if (mEglContext != null) {
      egl.eglDestroyContext(mEglDisplay, mEglContext);
      mEglContext = null;
    }

    if (mEglDisplay != null) {
      egl.eglTerminate(mEglDisplay);
      mEglDisplay = null;
    }
  }
コード例 #6
0
 public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
   egl.eglDestroyContext(display, context);
 }
コード例 #7
0
 /*--------- destroyContext-------------------------------------------------------------*/
 public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
   Log.d(TAG + "class ContextFactory", "destroyContext");
   egl.eglDestroyContext(display, context);
 }
コード例 #8
0
 @Override
 public void destroyContext(
     final EGL10 egl, final EGLDisplay display, final EGLContext context) {
   Log.v(TAG, "EGLContextFactory.destroyContext");
   egl.eglDestroyContext(display, context);
 }
コード例 #9
0
  public void run() {
    // Much of this code is from GLSurfaceView in the Google API Demos.
    // I encourage those interested to look there for documentation.
    EGL10 egl = (EGL10) EGLContext.getEGL();
    EGLDisplay dpy = egl.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);

    int[] version = new int[2];
    egl.eglInitialize(dpy, version);

    int[] configSpec = {
      EGL10.EGL_RED_SIZE, 5,
      EGL10.EGL_GREEN_SIZE, 6,
      EGL10.EGL_BLUE_SIZE, 5,
      EGL10.EGL_DEPTH_SIZE, 16,
      EGL10.EGL_NONE
    };

    EGLConfig[] configs = new EGLConfig[1];
    int[] num_config = new int[1];
    egl.eglChooseConfig(dpy, configSpec, configs, 1, num_config);
    EGLConfig config = configs[0];

    EGLContext context = egl.eglCreateContext(dpy, config, EGL10.EGL_NO_CONTEXT, null);

    EGLSurface surface = egl.eglCreateWindowSurface(dpy, config, sHolder, null);
    egl.eglMakeCurrent(dpy, surface, surface, context);

    GL10 gl = (GL10) context.getGL();

    init(gl);

    int delta = -1;
    if (fps > 0) {
      delta = 1000 / fps;
    }
    long time = System.currentTimeMillis();

    running = true;
    while (running) {
      int w, h;
      synchronized (this) {
        w = width;
        h = height;
      }
      if (System.currentTimeMillis() - time < delta) {
        try {
          Thread.sleep(System.currentTimeMillis() - time);
        } catch (InterruptedException ex) {
        }
      }
      drawFrame(gl, w, h);
      egl.eglSwapBuffers(dpy, surface);

      if (egl.eglGetError() == EGL11.EGL_CONTEXT_LOST) {
        Context c = getContext();
        if (c instanceof Activity) {
          ((Activity) c).finish();
        }
      }
      time = System.currentTimeMillis();
    }
    egl.eglMakeCurrent(dpy, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
    egl.eglDestroySurface(dpy, surface);
    egl.eglDestroyContext(dpy, context);
    egl.eglTerminate(dpy);
  }
コード例 #10
0
ファイル: x.java プロジェクト: 007slm/WeChatRE
 public final void destroyContext(
     EGL10 paramEGL10, EGLDisplay paramEGLDisplay, EGLContext paramEGLContext) {
   paramEGL10.eglDestroyContext(paramEGLDisplay, paramEGLContext);
 }
コード例 #11
0
ファイル: GlView.java プロジェクト: Thommil/KeskGL
 public void destroyContext(EGL10 egl, EGLDisplay display, EGLContext context) {
   if (!egl.eglDestroyContext(display, context)) {
     android.util.Log.e("DefaultContextFactory", "display:" + display + " context: " + context);
     EglHelper.throwEglException("eglDestroyContex", egl.eglGetError());
   }
 }