Переглянути джерело

fixing flickering issues on iOS 10

a flush at the end of the buffer is required in case we are on iOS 10,
(until apple will fix their drivers).
I am sadly using ua sniffing, as there is no other way of detecting the
version of the browser.
Raanan Weber 9 роки тому
батько
коміт
81ba1a3695
1 змінених файлів з 11 додано та 1 видалено
  1. 11 1
      src/babylon.engine.ts

+ 11 - 1
src/babylon.engine.ts

@@ -410,6 +410,8 @@
         private _windowIsBackground = false;
         private _webGLVersion = "1.0";
 
+        private _badOS = false; 
+
         public static audioEngine: AudioEngine;
 
         private _onBlur: () => void;
@@ -650,6 +652,11 @@
                 this.initWebVR();
             }
 
+            //Detect if we are running on a faulty buggy OS.
+            var regexp = /iPhone.*10.[\d] Mobile/
+            //ua sniffing is the tool of the devil.
+            this._badOS = regexp.test(navigator.userAgent);
+
             Tools.Log("Babylon.js engine (v" + Engine.Version + ") launched");
         }
 
@@ -989,7 +996,10 @@
         }
 
         public endFrame(): void {
-            //this.flushFramebuffer();
+            //force a flush in case we are using a bad OS.
+            if(this._badOS) {
+                this.flushFramebuffer();
+            }
 
             //submit frame to the vr device, if enabled
             if (this._vrDisplayEnabled && this._vrDisplayEnabled.isPresenting) {