Esempio n. 1
0
 /**
  * Inform the view that the activity is resumed. The owner of this view must call this method when
  * the activity is resumed. Calling this method will recreate the OpenGL display and resume the
  * rendering thread. Must not be called before a renderer has been set.
  */
 public void play() {
   if (mGLThread != null) {
     mGLThread.onResume();
   } else {
     mGLThread = new GLThread(mThisWeakRef);
     mGLThread.listenFPS = this.listenFps;
     mGLThread.fpsListener = this.fpsListener;
     mGLThread.start();
   }
 }
Esempio n. 2
0
 @SuppressWarnings("PMD")
 public void threadExiting(GLThread thread) {
   synchronized (this) {
     if (LOG_THREADS) {
       Log.i("GLThread", "exiting tid=" + thread.getId());
     }
     thread.mExited = true;
     if (mEglOwner == thread) {
       mEglOwner = null;
     }
     notifyAll();
   }
 }
Esempio n. 3
0
 public synchronized void threadExiting(GLThread thread) {
   thread.mExited = true;
   if (mEglOwner == thread) {
     mEglOwner = null;
   }
   notifyAll();
 }
Esempio n. 4
0
 /**
  * This method is used as part of the View class and is not normally called or subclassed by
  * clients of GLSceneView. Must not be called before a renderer has been set.
  */
 @Override
 protected void onDetachedFromWindow() {
   if (mGLThread != null) {
     mGLThread.requestExitAndWait();
   }
   mDetached = true;
   super.onDetachedFromWindow();
 }
Esempio n. 5
0
 @Override
 protected void finalize() throws Throwable {
   try {
     if (mGLThread != null) {
       // GLThread may still be running if this view was never
       // attached to a window.
       mGLThread.requestExitAndWait();
     }
   } finally {
     super.finalize();
   }
 }
Esempio n. 6
0
 /**
  * Queue a runnable to be run on the GL rendering thread. This can be used to communicate with the
  * Renderer on the rendering thread. Must not be called before a renderer has been set.
  *
  * @param r the runnable to be run on the GL rendering thread.
  */
 @Override
 public void runOnGLThread(Runnable r) {
   if (mGLThread != null) {
     mGLThread.queueEvent(r);
   }
 }
Esempio n. 7
0
 /**
  * Inform the view that the activity is paused. The owner of this view must call this method when
  * the activity is paused. Calling this method will pause the rendering thread. Must not be called
  * before a renderer has been set.
  */
 public void pause() {
   if (mGLThread != null) {
     mGLThread.onPause();
   }
 }
Esempio n. 8
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not normally called or
  * subclassed by clients of GLSceneView.
  */
 public void surfaceChanged(SurfaceHolder holder, int format, int w, int h) {
   if (mGLThread != null) {
     mGLThread.onWindowResize(w, h);
   }
 }
Esempio n. 9
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not normally called or
  * subclassed by clients of GLSceneView.
  */
 public void surfaceDestroyed(SurfaceHolder holder) {
   // Surface will be destroyed when we return
   if (mGLThread != null) {
     mGLThread.surfaceDestroyed();
   }
 }
Esempio n. 10
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not normally called or
  * subclassed by clients of GLSceneView.
  */
 public void surfaceCreated(SurfaceHolder holder) {
   if (mGLThread != null) {
     mGLThread.surfaceCreated();
   }
 }