コード例 #1
0
        protected override void OnElementChanged(ElementChangedEventArgs <VeldridView> e)
        {
            base.OnElementChanged(e);

            if (e.NewElement == default)
            {
                return;
            }

            var debug = false;

#if DEBUG
            debug = true;
#endif
            var options = new GraphicsDeviceOptions(debug, PixelFormat.R16_UNorm, false, ResourceBindingModel.Improved, true, true);
            var backend = GraphicsDevice.IsBackendSupported(GraphicsBackend.Vulkan) ? GraphicsBackend.Vulkan : GraphicsBackend.OpenGLES;
            var view    = new VeldridSurfaceView(Context, backend, options);
            var window  = new AndroidApplicationWindow(view);
            window.GraphicsDeviceCreated += (g, r, s) => window.Run();
            //var app = new AnimatedMeshApplication(window);
            //var app = new ComputeParticlesApplication(window);
            //var app = new ComputeTextureApplication(window);
            var app = new InstancingApplication(window);
            //var app = new OffscreenApplication(window);

            SetNativeControl(view);
        }
コード例 #2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);

            var debug = false;

#if DEBUG
            debug = true;
#endif
            var options = new GraphicsDeviceOptions(debug, PixelFormat.R16_UNorm, false, ResourceBindingModel.Improved, true, true);
            var backend = GraphicsDevice.IsBackendSupported(GraphicsBackend.Vulkan) ? GraphicsBackend.Vulkan : GraphicsBackend.OpenGLES;
            view = new VeldridSurfaceView(this, backend, options);
            var window = new AndroidApplicationWindow(view);
            window.GraphicsDeviceCreated += (g, r, s) => window.Run();
            var app = new InstancingApplication(window);

            SetContentView(view);
        }