diff --git a/examples/webgl_gpgpu_water.html b/examples/webgl_gpgpu_water.html index bc8b5eac7e4aa6..d316876af769c5 100644 --- a/examples/webgl_gpgpu_water.html +++ b/examples/webgl_gpgpu_water.html @@ -646,8 +646,11 @@ var v = 1 - ( 0.5 * sphere.position.z / BOUNDS_HALF + 0.5 ); readWaterLevelShader.uniforms[ "point1" ].value.set( u, v ); gpuCompute.doRenderTarget( readWaterLevelShader, readWaterLevelRenderTarget ); + var previousRenderTarget = renderer.getRenderTarget(); + renderer.setRenderTarget( readWaterLevelRenderTarget ); gl.readPixels( 0, 0, 4, 1, gl.RGBA, gl.UNSIGNED_BYTE, readWaterLevelImage ); var pixels = new Float32Array( readWaterLevelImage.buffer ); + renderer.setRenderTarget( previousRenderTarget ); // Get orientation waterNormal.set( pixels[ 1 ], 0, - pixels[ 2 ] ); @@ -798,4 +801,4 @@ - \ No newline at end of file +