public void OnSurfaceChanged(IGL10 gl, int width, int height)
 {
     lock (this) {
         if (_baseMapView != null)
         {
             _baseMapView.OnSurfaceChanged(width, height);
         }
     }
 }
 public void OnSurfaceChanged(IGL10 gl, int width, int height)
 {
     lock (this) {
         BaseMapView baseMapView = null;
         _baseMapView.TryGetTarget(out baseMapView);
         if (baseMapView != null)
         {
             baseMapView.OnSurfaceChanged(width, height);
         }
     }
 }
示例#3
0
        private void InitBase()
        {
            this.Delegate = new MapViewGLKViewDelegate();

            _didEnterBackgroundNotificationObserver  = NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.DidEnterBackgroundNotification, OnAppDidEnterBackground, null);
            _willEnterForegroundNotificationObserver = NSNotificationCenter.DefaultCenter.AddObserver(UIApplication.WillEnterForegroundNotification, OnAppWillEnterForeground, null);

            _active = true;

            _scale = (float)UIScreen.MainScreen.NativeScale;

            _baseMapView = new BaseMapView();
            _baseMapView.GetOptions().DPI = 160 * _scale;

            _redrawRequestListener = new MapRedrawRequestListener(this);
            _baseMapView.SetRedrawRequestListener(_redrawRequestListener);

            _viewContext = new EAGLContext(EAGLRenderingAPI.OpenGLES2);
            if (_viewContext == null)
            {
                Log.Fatal("MapView.InitGL: Failed to create OpenGLES 2.0 context");
            }
            this.Context            = _viewContext;
            this.ContentScaleFactor = _scale;

            DrawableColorFormat   = GLKViewDrawableColorFormat.RGBA8888;
            DrawableDepthFormat   = GLKViewDrawableDepthFormat.Format24;
            DrawableMultisample   = GLKViewDrawableMultisample.None;
            DrawableStencilFormat = GLKViewDrawableStencilFormat.Format8;
            MultipleTouchEnabled  = true;

            if (_viewContext != null)
            {
                EAGLContext.SetCurrentContext(_viewContext);
                _baseMapView.OnSurfaceCreated();
                _baseMapView.OnSurfaceChanged((int)(Bounds.Size.Width * _scale), (int)(Bounds.Size.Height * _scale));
            }

            SetNeedsDisplay();
        }