Пример #1
0
        protected override void Dispose(bool disposing)
        {
            if (disposed)
            {
                return;
            }

            if (disposing)
            {
                CleanUpTextures();

                if (videoTextureCache != null)
                {
                    videoTextureCache.Flush(CVOptionFlags.None);
                    videoTextureCache.Dispose();
                }

                if (context != null)
                {
                    context.Dispose();
                }
            }

            GL.DeleteFramebuffers(1, ref frameBufferHandle);
            GL.DeleteRenderbuffers(1, ref colorBufferHandle);
            disposed = true;

            base.Dispose(disposing);
        }
Пример #2
0
        protected override void Dispose(bool disposing)
        {
            base.Dispose(disposing);

            context.Dispose();
            glContext.Dispose();
        }
Пример #3
0
 protected virtual void Dispose(bool disposing)
 {
     if (EAGLContext != null)
     {
         EAGLContext.Dispose();
     }
     EAGLContext = null;
 }
Пример #4
0
        internal override void Initialize(GameContext gameContext)
        {
            GameContext = gameContext;

            gameForm = gameContext.GameView;
            nativeWindow = new WindowHandle(AppContextType.iOS, gameForm);

            gameForm.Load += gameForm_Load;
            gameForm.Unload += gameForm_Unload;
            gameForm.RenderFrame += gameForm_RenderFrame;
            
            // get the OpenGL ES version
            var contextAvailable = false;
            foreach (var version in OpenGLUtils.GetGLVersions(gameContext.RequestedGraphicsProfile))
            {
                var contextRenderingApi = MajorVersionTOEAGLRenderingAPI(version);
                EAGLContext contextTest = null;
                try
                {
                    contextTest = new EAGLContext(contextRenderingApi);

                    // delete extra context
                    if (contextTest != null)
                        contextTest.Dispose();

                    gameForm.ContextRenderingApi = contextRenderingApi;
                    contextAvailable = true;
                }
                catch (Exception)
                {
                    // TODO: log message
                }
            }

            if (!contextAvailable)
                throw new Exception("Graphics context could not be created.");

            gameForm.LayerColorFormat = MonoTouch.OpenGLES.EAGLColorFormat.RGBA8;
            //gameForm.LayerRetainsBacking = false;

            // Setup the initial size of the window
            var width = gameContext.RequestedWidth;
            if (width == 0)
            {
                width = (int)(gameForm.Size.Width * gameForm.ContentScaleFactor);
            }

            var height = gameContext.RequestedHeight;
            if (height == 0)
            {
                height = (int)(gameForm.Size.Height * gameForm.ContentScaleFactor);
            }

            gameForm.Size = new Size(width, height);

            //gameForm.Resize += OnClientSizeChanged;
        }
Пример #5
0
 void DestroyContext()
 {
     EAGLContext.SetCurrentContext(_glContext);
     GL.DeleteRenderbuffers(1, ref _db);
     GL.DeleteRenderbuffers(1, ref _cb);
     GL.DeleteFramebuffers(1, ref _fb);
     _db = _cb = _fb = 0;
     _glContext.Dispose();
     _alContext.Dispose();
 }
Пример #6
0
 protected override void Dispose(bool disposing)
 {
     if (IsDisposed)
     {
         return;
     }
     if (EAGLContext != null)
     {
         EAGLContext.Dispose();
     }
     EAGLContext = null;
     IsDisposed  = true;
 }
Пример #7
0
 protected override void Dispose(bool disposing)
 {
     if (!IsDisposed)
     {
         if (disposing)
         {
             if (EAGLContext != null)
             {
                 EAGLContext.Dispose();
             }
             EAGLContext = null;
         }
         IsDisposed = true;
     }
 }
Пример #8
0
        protected override void Initialize(GameContext <iOSWindow> gameContext)
        {
            gameForm     = gameContext.Control.GameView;
            nativeWindow = new WindowHandle(AppContextType.iOS, gameForm, gameForm.Handle);

            gameForm.Load        += gameForm_Load;
            gameForm.Unload      += gameForm_Unload;
            gameForm.RenderFrame += gameForm_RenderFrame;

            // get the OpenGL ES version
            var contextAvailable = false;

            foreach (var version in OpenGLUtils.GetGLVersions(gameContext.RequestedGraphicsProfile))
            {
                var         contextRenderingApi = MajorVersionTOEAGLRenderingAPI(version);
                EAGLContext contextTest         = null;
                try
                {
                    contextTest = new EAGLContext(contextRenderingApi);

                    // delete extra context
                    if (contextTest != null)
                    {
                        contextTest.Dispose();
                    }

                    gameForm.ContextRenderingApi = contextRenderingApi;
                    contextAvailable             = true;
                    break;
                }
                catch (Exception)
                {
                    // TODO: log message
                }
            }

            if (!contextAvailable)
            {
                throw new Exception("Graphics context could not be created.");
            }

            gameForm.LayerColorFormat = EAGLColorFormat.RGBA8;
            //gameForm.LayerRetainsBacking = false;

            currentOrientation = UIApplication.SharedApplication.StatusBarOrientation;
        }
Пример #9
0
        internal override void Initialize(GameContext gameContext)
        {
            GameContext = gameContext;

            gameForm = gameContext.GameView;
            nativeWindow = new WindowHandle(AppContextType.iOS, gameForm);

            gameForm.Load += gameForm_Load;
            gameForm.Unload += gameForm_Unload;
            gameForm.RenderFrame += gameForm_RenderFrame;
            
            // get the OpenGL ES version
            var contextAvailable = false;
            foreach (var version in OpenGLUtils.GetGLVersions(gameContext.RequestedGraphicsProfile))
            {
                var contextRenderingApi = MajorVersionTOEAGLRenderingAPI(version);
                EAGLContext contextTest = null;
                try
                {
                    contextTest = new EAGLContext(contextRenderingApi);

                    // delete extra context
                    if (contextTest != null)
                        contextTest.Dispose();

                    gameForm.ContextRenderingApi = contextRenderingApi;
                    contextAvailable = true;
                    break;
                }
                catch (Exception)
                {
                    // TODO: log message
                }
            }

            if (!contextAvailable)
                throw new Exception("Graphics context could not be created.");

            gameForm.LayerColorFormat = EAGLColorFormat.RGBA8;
            //gameForm.LayerRetainsBacking = false;
        }
Пример #10
0
 public void Dispose()
 {
     Context?.Dispose();
     Context = null;
 }
Пример #11
0
        internal override void Initialize(GameContext gameContext)
        {
            GameContext = gameContext;

            gameForm     = gameContext.GameView;
            nativeWindow = new WindowHandle(AppContextType.iOS, gameForm);

            gameForm.Load        += gameForm_Load;
            gameForm.Unload      += gameForm_Unload;
            gameForm.RenderFrame += gameForm_RenderFrame;

            // get the OpenGL ES version
            var contextAvailable = false;

            foreach (var version in OpenGLUtils.GetGLVersions(gameContext.RequestedGraphicsProfile))
            {
                var         contextRenderingApi = MajorVersionTOEAGLRenderingAPI(version);
                EAGLContext contextTest         = null;
                try
                {
                    contextTest = new EAGLContext(contextRenderingApi);

                    // delete extra context
                    if (contextTest != null)
                    {
                        contextTest.Dispose();
                    }

                    gameForm.ContextRenderingApi = contextRenderingApi;
                    contextAvailable             = true;
                }
                catch (Exception)
                {
                    // TODO: log message
                }
            }

            if (!contextAvailable)
            {
                throw new Exception("Graphics context could not be created.");
            }

            gameForm.LayerColorFormat = MonoTouch.OpenGLES.EAGLColorFormat.RGBA8;
            //gameForm.LayerRetainsBacking = false;

            // Setup the initial size of the window
            var width = gameContext.RequestedWidth;

            if (width == 0)
            {
                width = (int)(gameForm.Size.Width * gameForm.ContentScaleFactor);
            }

            var height = gameContext.RequestedHeight;

            if (height == 0)
            {
                height = (int)(gameForm.Size.Height * gameForm.ContentScaleFactor);
            }

            gameForm.Size = new Size(width, height);

            //gameForm.Resize += OnClientSizeChanged;
        }