Browse Source

Add Toggle for UnpackFlipYCache

sebastien 7 years ago
parent
commit
ad770407e9
1 changed files with 13 additions and 2 deletions
  1. 13 2
      src/Engine/babylon.engine.ts

+ 13 - 2
src/Engine/babylon.engine.ts

@@ -4412,11 +4412,22 @@
         }
 
         private _unpackFlipYCached: Nullable<boolean> = null;
+
+        /**
+         * In case you are sharing the context with other applications, it might 
+         * be interested to not cache the unpack flip y state to ensure a consistent 
+         * value would be set.
+         */
+        public enableUnpackFlipYCached = true;
+
         /** @hidden */
-        public _unpackFlipY(value: boolean) {
+        public _unpackFlipY(value: boolean): void {
             if (this._unpackFlipYCached !== value) {
-                this._unpackFlipYCached = value;
                 this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL, value ? 1 : 0);
+
+                if (this.enableUnpackFlipYCached) {
+                    this._unpackFlipYCached = value;
+                }
             }
         }