/** * 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(); } }
@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(); } }
public synchronized void threadExiting(GLThread thread) { thread.mExited = true; if (mEglOwner == thread) { mEglOwner = null; } notifyAll(); }
/** * 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(); }
@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(); } }
/** * 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); } }
/** * 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(); } }
/** * 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); } }
/** * 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(); } }
/** * 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(); } }