Esempio n. 1
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not
  * normally called or subclassed by clients of GLSurfaceView.
  */
 public void SurfaceCreated(SurfaceHolder holder)
 {
     if (this.mGLThread != null)
     {
         this.mGLThread.SurfaceCreated();
     }
     this.mHasSurface = true;
 }
Esempio n. 2
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not
  * normally called or subclassed by clients of GLSurfaceView.
  */
 public void SurfaceChanged(SurfaceHolder holder, int format, int w, int h)
 {
     if (this.mGLThread != null)
     {
         this.mGLThread.OnWindowResize(w, h);
     }
     this.mSurfaceWidth  = w;
     this.mSurfaceHeight = h;
 }
Esempio n. 3
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not
  * normally called or subclassed by clients of GLSurfaceView.
  */
 public void SurfaceDestroyed(SurfaceHolder holder)
 {
     // Surface will be destroyed when we return
     if (this.mGLThread != null)
     {
         this.mGLThread.SurfaceDestroyed();
     }
     this.mHasSurface = false;
 }
Esempio n. 4
0
        private void Init()
        {
            // Install a SurfaceHolder.Callback so we get notified when the
            // underlying surface is created and destroyed
            SurfaceHolder holder = this.Holder;

            holder.AddCallback(this);
            holder.SetType(Android.Views.SurfaceType.Gpu);
            this.RenderMode = RENDERMODE_CONTINUOUSLY;

            GLSurfaceView.Instance = this;
        }
Esempio n. 5
0
            /*
             * React to the creation of a new surface by creating and returning an
             * OpenGL interface that renders to that surface.
             */
            public GL CreateSurface(SurfaceHolder holder)
            {
                /*
                 * The window size has changed, so we need to create a new surface.
                 */
                if (this.mEglSurface != null)
                {
                    /*
                     * Unbind and destroy the old EGL surface, if there is one.
                     */
                    this.mEgl.EglMakeCurrent(this.mEglDisplay, EGL10Consts.EglNoSurface, EGL10Consts.EglNoSurface, EGL10Consts.EglNoContext);
                    this.mEgl.EglDestroySurface(this.mEglDisplay, this.mEglSurface);
                }

                /*
                 * Create an EGL surface we can render into.
                 */
                this.mEglSurface = this.mEgl.EglCreateWindowSurface(this.mEglDisplay, this.mEglConfig, (Object)holder, null);

                /*
                 * Before we can issue GL commands, we need to make sure the context
                 * is current and bound to a surface.
                 */
                this.mEgl.EglMakeCurrent(this.mEglDisplay, this.mEglSurface, this.mEglSurface, this.mEglContext);

                GL gl = this.mEglContext.GL;

                if (GLSurfaceView.Instance.mGLWrapper != null)
                {
                    gl = GLSurfaceView.Instance.mGLWrapper.wrap(gl);
                }

                /* Debugging disabled */

                /*
                 * if ((mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS))!=
                 * 0) { int configFlags = 0; Writer log = null; if ((mDebugFlags &
                 * DEBUG_CHECK_GL_ERROR) != 0) { configFlags |=
                 * GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((mDebugFlags &
                 * DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl =
                 * GLDebugHelper.wrap(gl, configFlags, log); }
                 */
                return(gl);
            }
Esempio n. 6
0
            /*
             * React to the creation of a new surface by creating and returning an
             * OpenGL interface that renders to that surface.
             */
            public GL CreateSurface(SurfaceHolder holder)
            {
                /*
                 * The window size has changed, so we need to create a new surface.
                 */
                if (this.mEglSurface != null)
                {

                    /*
                     * Unbind and destroy the old EGL surface, if there is one.
                     */
                    this.mEgl.EglMakeCurrent(this.mEglDisplay, EGL10Consts.EglNoSurface, EGL10Consts.EglNoSurface, EGL10Consts.EglNoContext);
                    this.mEgl.EglDestroySurface(this.mEglDisplay, this.mEglSurface);
                }

                /*
                 * Create an EGL surface we can render into.
                 */
                this.mEglSurface = this.mEgl.EglCreateWindowSurface(this.mEglDisplay, this.mEglConfig, (Object) holder, null);

                /*
                 * Before we can issue GL commands, we need to make sure the context
                 * is current and bound to a surface.
                 */
                this.mEgl.EglMakeCurrent(this.mEglDisplay, this.mEglSurface, this.mEglSurface, this.mEglContext);

                GL gl = this.mEglContext.GL;
                if (GLSurfaceView.Instance.mGLWrapper != null)
                {
                    gl = GLSurfaceView.Instance.mGLWrapper.wrap(gl);
                }

                /* Debugging disabled */
                /*
                 * if ((mDebugFlags & (DEBUG_CHECK_GL_ERROR | DEBUG_LOG_GL_CALLS))!=
                 * 0) { int configFlags = 0; Writer log = null; if ((mDebugFlags &
                 * DEBUG_CHECK_GL_ERROR) != 0) { configFlags |=
                 * GLDebugHelper.CONFIG_CHECK_GL_ERROR; } if ((mDebugFlags &
                 * DEBUG_LOG_GL_CALLS) != 0) { log = new LogWriter(); } gl =
                 * GLDebugHelper.wrap(gl, configFlags, log); }
                 */
                return gl;
            }
Esempio n. 7
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not
  * normally called or subclassed by clients of GLSurfaceView.
  */
 public void SurfaceChanged(SurfaceHolder holder, int format, int w, int h)
 {
     if (this.mGLThread != null)
     {
         this.mGLThread.OnWindowResize(w, h);
     }
     this.mSurfaceWidth = w;
     this.mSurfaceHeight = h;
 }
Esempio n. 8
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not
  * normally called or subclassed by clients of GLSurfaceView.
  */
 public void SurfaceDestroyed(SurfaceHolder holder)
 {
     // Surface will be destroyed when we return
     if (this.mGLThread != null)
     {
         this.mGLThread.SurfaceDestroyed();
     }
     this.mHasSurface = false;
 }
Esempio n. 9
0
 /**
  * This method is part of the SurfaceHolder.Callback interface, and is not
  * normally called or subclassed by clients of GLSurfaceView.
  */
 public void SurfaceCreated(SurfaceHolder holder)
 {
     if (this.mGLThread != null)
     {
         this.mGLThread.SurfaceCreated();
     }
     this.mHasSurface = true;
 }