internal iPhoneOSGraphicsContext(GraphicsMode mode, IWindowInfo window, IGraphicsContext sharedContext, int major, int minor, GraphicsContextFlags flags)
        {
            // ignore mode, window

            iPhoneOSGraphicsContext shared = sharedContext as iPhoneOSGraphicsContext;

            EAGLRenderingAPI version = 0;
            if (major == 1 && minor == 1)
            {
                version = EAGLRenderingAPI.OpenGLES1;
            }
            else if (major == 2 && minor == 0)
            {
                version = EAGLRenderingAPI.OpenGLES2;
            }
            else if (major == 3 && minor == 0)
            {
                version = EAGLRenderingAPI.OpenGLES3;
            }
            else
            {
                throw new ArgumentException (string.Format("Unsupported GLES version {0}.{1}.", major, minor));
            }

            EAGLContext = shared != null && shared.EAGLContext != null
                ? new EAGLContext(version, shared.EAGLContext.ShareGroup)
                : new EAGLContext(version);
            Handle = new ContextHandle(EAGLContext.Handle);
        }
		public EAGLView (CGRect frame, All format, All depth, bool retained) : base (frame)
		{
			CAEAGLLayer eaglLayer = (CAEAGLLayer) Layer;
			eaglLayer.DrawableProperties = new NSDictionary (
				EAGLDrawableProperty.RetainedBacking, true,
				EAGLDrawableProperty.ColorFormat, EAGLColorFormat.RGBA8
			);

			_depthFormat = depth;

			_context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;
			CreateSurface ();
		}
		public EAGLView (NSCoder coder) : base (coder)
		{
			CAEAGLLayer eaglLayer = (CAEAGLLayer) Layer;
			eaglLayer.Opaque = true;
			eaglLayer.DrawableProperties = new NSDictionary (
				EAGLDrawableProperty.RetainedBacking, false,
				EAGLDrawableProperty.ColorFormat, EAGLColorFormat.RGBA8
			);
			Context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;

			Context.MakeCurrent(null);
			AnimationInterval = 1.0 / 60.0;
		}
		public EAGLView (RectangleF frame, All format, All depth, bool retained) : base (frame)
		{
			CAEAGLLayer eaglLayer = (CAEAGLLayer) Layer;
			eaglLayer.DrawableProperties = NSDictionary.FromObjectsAndKeys (
				new NSObject [] {NSNumber.FromBoolean (true),           EAGLColorFormat.RGBA8},
				new NSObject [] {EAGLDrawableProperty.RetainedBacking,  EAGLDrawableProperty.ColorFormat}
			);
			_format = format;
			_depthFormat = depth;

			_context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;
			CreateSurface ();
		}
Exemple #5
0
		public EAGLView (NSCoder coder) : base (coder)
		{
			CAEAGLLayer eaglLayer = (CAEAGLLayer) Layer;
			eaglLayer.Opaque = true;
			eaglLayer.DrawableProperties = NSDictionary.FromObjectsAndKeys (
				new NSObject []{NSNumber.FromBoolean(false),          EAGLColorFormat.RGBA8},
				new NSObject []{EAGLDrawableProperty.RetainedBacking, EAGLDrawableProperty.ColorFormat}
			);
			Context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;
			
			Context.MakeCurrent(null);
			AnimationInterval = 1.0 / 60.0;
		}
Exemple #6
0
        public CanvasView(RectangleF frame,AppDelegate appDelegate)
            : base(frame)
        {
            this.appDelegate = appDelegate;

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

            Context = (iPhoneOSGraphicsContext) ((IGraphicsContextInternal) GraphicsContext.CurrentContext).Implementation;

            Context.MakeCurrent(null);

            createFrameBuffer ();

            animationInterval = 1.0f / 60.0f;

            SetupView();
            DrawView();
        }
		protected override void Dispose (bool disposing)
		{
			DestroySurface ();
			_context.Dispose();
			_context = null;
		}