Beispiel #1
0
        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;
        }
Beispiel #2
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();
        }
    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;
    }
Beispiel #4
0
        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(RectangleF frame) : base(frame)
        {
            CAEAGLLayer eagl = (CAEAGLLayer)Layer;

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

            eagl.ContentsScale = UIScreen.MainScreen.Scale;

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

            CAEAGLLayer eaglLayer = (CAEAGLLayer)Layer;

            context.MakeCurrent(null);

            GL.Oes.GenRenderbuffers(1, out renderbuffer);
            GL.Oes.BindRenderbuffer(All.RenderbufferOes, renderbuffer);

            if (!context.EAGLContext.RenderBufferStorage((uint)All.RenderbufferOes, eaglLayer))
            {
                throw new InvalidOperationException("Error with RenderbufferStorage()!");
            }

            GL.Oes.GenFramebuffers(1, out frameBuffer);
            GL.Oes.BindFramebuffer(All.FramebufferOes, frameBuffer);
            GL.Oes.FramebufferRenderbuffer(All.FramebufferOes, All.ColorAttachment0Oes, All.RenderbufferOes, renderbuffer);

            Instance = this;

            Opaque                 = true;
            ExclusiveTouch         = true;
            MultipleTouchEnabled   = true;
            UserInteractionEnabled = true;
        }
Beispiel #6
0
 protected override void Dispose(bool disposing)
 {
     DestroySurface();
     _context.Dispose();
     _context = null;
 }