David Catuhe 5 år sedan
förälder
incheckning
e7eb9fe4ff
1 ändrade filer med 7 tillägg och 1 borttagningar
  1. 7 1
      src/Engines/thinEngine.ts

+ 7 - 1
src/Engines/thinEngine.ts

@@ -3284,7 +3284,13 @@ export class ThinEngine {
             return this._getDepthStencilBuffer(width, height, samples, gl.DEPTH_STENCIL, gl.DEPTH24_STENCIL8, gl.DEPTH_STENCIL_ATTACHMENT);
         }
         if (generateDepthBuffer) {
-            return this._getDepthStencilBuffer(width, height, samples, gl.DEPTH_COMPONENT16, gl.DEPTH_COMPONENT16, gl.DEPTH_ATTACHMENT);
+            let anyGl = <any>gl;
+            let depthFormat = gl.DEPTH_COMPONENT16;
+            if (this._webGLVersion > 1) {
+                depthFormat = anyGl.DEPTH_COMPONENT32F;
+            }
+
+            return this._getDepthStencilBuffer(width, height, samples, depthFormat, depthFormat, gl.DEPTH_ATTACHMENT);
         }
         if (generateStencilBuffer) {
             return this._getDepthStencilBuffer(width, height, samples, gl.STENCIL_INDEX8, gl.STENCIL_INDEX8, gl.STENCIL_ATTACHMENT);