Exemple #1
0
        private void CreateContext()
        {
            AssertNotDisposed();

            // RetainedBacking controls if the content of the colorbuffer should be preserved after being displayed
            // This is the XNA equivalent to set PreserveContent when initializing the GraphicsDevice
            // (should be false by default for better performance)
            Layer.DrawableProperties = NSDictionary.FromObjectsAndKeys(
                new NSObject [] {
                NSNumber.FromBoolean(false),
                EAGLColorFormat.RGBA8
            },
                new NSObject [] {
                EAGLDrawableProperty.RetainedBacking,
                EAGLDrawableProperty.ColorFormat
            });

            Layer.ContentsScale = Window.Screen.Scale;

            //var strVersion = OpenTK.Graphics.ES11.GL.GetString (OpenTK.Graphics.ES11.All.Version);
            //strVersion = OpenTK.Graphics.ES20.GL.GetString (OpenTK.Graphics.ES20.All.Version);
            //var version = Version.Parse (strVersion);

            try {
                __renderbuffergraphicsContext = new GraphicsContext(null, null, 2, 0, GraphicsContextFlags.Embedded);
                _glapi = new Gles20Api();
            } catch {
                __renderbuffergraphicsContext = new GraphicsContext(null, null, 1, 1, GraphicsContextFlags.Embedded);
                _glapi = new Gles11Api();
            }

            __renderbuffergraphicsContext.MakeCurrent(null);
        }
        private void CreateContext()
        {
            AssertNotDisposed();

            Layer.DrawableProperties = NSDictionary.FromObjectsAndKeys(
                new NSObject [] {
                NSNumber.FromBoolean(true),
                EAGLColorFormat.RGBA8
            },
                new NSObject [] {
                EAGLDrawableProperty.RetainedBacking,
                EAGLDrawableProperty.ColorFormat
            });

            Layer.ContentsScale = Window.Screen.Scale;

            //var strVersion = OpenTK.Graphics.ES11.GL.GetString (OpenTK.Graphics.ES11.All.Version);
            //strVersion = OpenTK.Graphics.ES20.GL.GetString (OpenTK.Graphics.ES20.All.Version);
            //var version = Version.Parse (strVersion);

            try {
                __renderbuffergraphicsContext = new GraphicsContext(null, null, 2, 0, GraphicsContextFlags.Embedded);
                _glapi = new Gles20Api();
            } catch {
                __renderbuffergraphicsContext = new GraphicsContext(null, null, 1, 1, GraphicsContextFlags.Embedded);
                _glapi = new Gles11Api();
            }

            __renderbuffergraphicsContext.MakeCurrent(null);
        }
Exemple #3
0
        private void DestroyContext()
        {
            AssertNotDisposed();
            AssertValidContext();

            __renderbuffergraphicsContext.Dispose();
            __renderbuffergraphicsContext = null;
            _glapi = null;
        }
Exemple #4
0
        private void CreateContext()
        {
            AssertNotDisposed();

            Layer.DrawableProperties = NSDictionary.FromObjectsAndKeys(
                new NSObject [] {
                NSNumber.FromBoolean(true),
                EAGLColorFormat.RGBA8
            },
                new NSObject [] {
                EAGLDrawableProperty.RetainedBacking,
                EAGLDrawableProperty.ColorFormat
            });

            Layer.ContentsScale = Window.Screen.Scale;

            //var strVersion = OpenTK.Graphics.ES11.GL.GetString (OpenTK.Graphics.ES11.All.Version);
            //strVersion = OpenTK.Graphics.ES20.GL.GetString (OpenTK.Graphics.ES20.All.Version);
            //var version = Version.Parse (strVersion);

            EAGLRenderingAPI eaglRenderingAPI;

//			try {
//				_graphicsContext = new GraphicsContext (null, null, 2, 0, GraphicsContextFlags.Embedded);
//				eaglRenderingAPI = EAGLRenderingAPI.OpenGLES2;
//				_glapi = new Gles20Api ();
//			} catch {
            {
                _graphicsContext = new GraphicsContext(null, null, 1, 1, GraphicsContextFlags.Embedded);
                eaglRenderingAPI = EAGLRenderingAPI.OpenGLES1;
                _glapi           = new Gles11Api();
            }

            _graphicsContext.MakeCurrent(null);
            // Should not be required any more _graphicsContext.LoadAll ();

            // FIXME: These static methods on GraphicsDevice need
            // to go away someday.
            GraphicsDevice.OpenGLESVersion = eaglRenderingAPI;
        }
Exemple #5
0
		private void DestroyContext ()
		{
			AssertNotDisposed ();
			AssertValidContext ();

			__renderbuffergraphicsContext.Dispose ();
			__renderbuffergraphicsContext = null;
			_glapi = null;
		}
Exemple #6
0
		private void CreateContext ()
		{
			AssertNotDisposed ();

            // RetainedBacking controls if the content of the colorbuffer should be preserved after being displayed
            // This is the XNA equivalent to set PreserveContent when initializing the GraphicsDevice
            // (should be false by default for better performance)
			Layer.DrawableProperties = NSDictionary.FromObjectsAndKeys (
				new NSObject [] {
					NSNumber.FromBoolean (false), 
					EAGLColorFormat.RGBA8
				},
				new NSObject [] {
					EAGLDrawableProperty.RetainedBacking,
					EAGLDrawableProperty.ColorFormat
				});

			Layer.ContentsScale = Window.Screen.Scale;

			//var strVersion = OpenTK.Graphics.ES11.GL.GetString (OpenTK.Graphics.ES11.All.Version);
			//strVersion = OpenTK.Graphics.ES20.GL.GetString (OpenTK.Graphics.ES20.All.Version);
			//var version = Version.Parse (strVersion);

			try {
				__renderbuffergraphicsContext = new GraphicsContext (null, null, 2, 0, GraphicsContextFlags.Embedded);
				_glapi = new Gles20Api ();
			} catch {
				__renderbuffergraphicsContext = new GraphicsContext (null, null, 1, 1, GraphicsContextFlags.Embedded);
				_glapi = new Gles11Api ();
			}

			this.MakeCurrent();
		}
		private void DestroyContext ()
		{
            AssertNotDisposed ();
            AssertValidContext ();
            
            __renderbuffergraphicsContext.Dispose ();
            __renderbuffergraphicsContext = null;

            
            Threading.BackgroundContext.Dispose();
            Threading.BackgroundContext=null;
            
            _glapi = null;
            if (!EAGLContext.SetCurrentContext (null))
                throw new Exception("Failed to clear current context!");
		}
		private void CreateContext ()
		{
			AssertNotDisposed ();

			Layer.DrawableProperties = NSDictionary.FromObjectsAndKeys (
				new NSObject [] {
					NSNumber.FromBoolean (true),
					EAGLColorFormat.RGBA8
				},
				new NSObject [] {
					EAGLDrawableProperty.RetainedBacking,
					EAGLDrawableProperty.ColorFormat
				});

			Layer.ContentsScale = Window.Screen.Scale;

			//var strVersion = OpenTK.Graphics.ES11.GL.GetString (OpenTK.Graphics.ES11.All.Version);
			//strVersion = OpenTK.Graphics.ES20.GL.GetString (OpenTK.Graphics.ES20.All.Version);
			//var version = Version.Parse (strVersion);

			try {
				__renderbuffergraphicsContext = new GraphicsContext (null, null, 2, 0, GraphicsContextFlags.Embedded);
				_glapi = new Gles20Api ();
			} catch {
				__renderbuffergraphicsContext = new GraphicsContext (null, null, 1, 1, GraphicsContextFlags.Embedded);
				_glapi = new Gles11Api ();
			}

			__renderbuffergraphicsContext.MakeCurrent (null);
		}
Exemple #9
0
		private void CreateContext ()
		{
			AssertNotDisposed ();

			Layer.DrawableProperties = NSDictionary.FromObjectsAndKeys (
				new NSObject [] {
					NSNumber.FromBoolean (true),
					EAGLColorFormat.RGBA8
				},
				new NSObject [] {
					EAGLDrawableProperty.RetainedBacking,
					EAGLDrawableProperty.ColorFormat
				});

			Layer.ContentsScale = Window.Screen.Scale;

			//var strVersion = OpenTK.Graphics.ES11.GL.GetString (OpenTK.Graphics.ES11.All.Version);
			//strVersion = OpenTK.Graphics.ES20.GL.GetString (OpenTK.Graphics.ES20.All.Version);
			//var version = Version.Parse (strVersion);

			EAGLRenderingAPI eaglRenderingAPI;
			try {
				_graphicsContext = new GraphicsContext (null, null, 2, 0, GraphicsContextFlags.Embedded);
				eaglRenderingAPI = EAGLRenderingAPI.OpenGLES2;
				_glapi = new Gles20Api ();
			} catch {
				_graphicsContext = new GraphicsContext (null, null, 1, 1, GraphicsContextFlags.Embedded);
				eaglRenderingAPI = EAGLRenderingAPI.OpenGLES1;
				_glapi = new Gles11Api ();
			}

			_graphicsContext.MakeCurrent (null);
			_graphicsContext.LoadAll ();

			// FIXME: These static methods on GraphicsDevice need
			// to go away someday.
			GraphicsDevice.OpenGLESVersion = eaglRenderingAPI;
		}