Browse Source

GPUComputationRenderer: Added check to make it work on iOS. (#9644)

* Added check to GPUComputationRenderer to make it work on iOS.

It checks if FloatType is supported by trying to render in a temporary render target.
If the check fails, it switches to HalfFloatType which works on iOS.

* Changed the detection method per mrdoob indication.
Juan Jose Luna Espinosa 9 years ago
parent
commit
cefe993143
1 changed files with 1 additions and 1 deletions
  1. 1 1
      examples/js/GPUComputationRenderer.js

+ 1 - 1
examples/js/GPUComputationRenderer.js

@@ -297,7 +297,7 @@ function GPUComputationRenderer( sizeX, sizeY, renderer ) {
 			minFilter: minFilter,
 			minFilter: minFilter,
 			magFilter: magFilter,
 			magFilter: magFilter,
 			format: THREE.RGBAFormat,
 			format: THREE.RGBAFormat,
-			type: THREE.FloatType,
+			type: ( /(iPad|iPhone|iPod)/g.test( navigator.userAgent ) ) ? THREE.HalfFloatType : THREE.FloatType,
 			stencilBuffer: false
 			stencilBuffer: false
 		} );
 		} );