Fix UWP specific issue - do not try to create EGL context when panel size is 0. Fixes
void OnPageLoaded(object sender, Windows.UI.Xaml.RoutedEventArgs args) {
// The SwapChainPanel has been created and arranged in the page layout, so EGL can be initialized.
CreateRenderSurface();
+
+ if (_renderSurface != IntPtr.Zero) {
StartRenderLoop();
}
+ }
void OnVisibilityChanged(Windows.UI.Core.CoreWindow sender, Windows.UI.Core.VisibilityChangedEventArgs args) {
+ if (args.Visible && _renderSurface == IntPtr.Zero) {
+ CreateRenderSurface();
+ }
+
if (args.Visible && _renderSurface != IntPtr.Zero) {
StartRenderLoop();
} else {
if (_renderSurface == IntPtr.Zero) {
int width = (int)(ConvertDipsToPixels(_swapChainPanelSize.Width) + 0.5f);
int height = (int)(ConvertDipsToPixels(_swapChainPanelSize.Height) + 0.5f);
+ if (width > 0 && height > 0) {
_renderSurface = _eglContext.CreateSurface(_swapChainPanel, width, height);
_eglContext.MakeCurrent(_renderSurface);
_baseMapView.OnSurfaceCreated();
}
}
+ }
void DestroyRenderSurface() {
if (_renderSurface != IntPtr.Zero) {
CreateRenderSurface();
}
+ if (_renderSurface != IntPtr.Zero) {
StartRenderLoop();
}
+ }
void StartRenderLoop() {
// If the render loop is already running then do not start another thread.
