فهرست منبع

Modified the examples/webgl_interactive_cubes_gpu.html to use the new readRenderTargetPixels function.

Gatis Kurzemnieks 10 سال پیش
والد
کامیت
04d88f815d
1فایلهای تغییر یافته به همراه3 افزوده شده و 4 حذف شده
  1. 3 4
      examples/webgl_interactive_cubes_gpu.html

+ 3 - 4
examples/webgl_interactive_cubes_gpu.html

@@ -203,12 +203,11 @@
 
 				renderer.render( pickingScene, camera, pickingTexture );
 
-				var gl = self.renderer.getContext();
+				//create buffer for reading single pixel
+				var pixelBuffer = new Uint8Array( 4 );
 
 				//read the pixel under the mouse from the texture
-
-				var pixelBuffer = new Uint8Array( 4 );
-				gl.readPixels( mouse.x, pickingTexture.height - mouse.y, 1, 1, gl.RGBA, gl.UNSIGNED_BYTE, pixelBuffer );
+				renderer.readRenderTargetPixels(pickingTexture, mouse.x, pickingTexture.height - mouse.y, 1, 1, pixelBuffer);
 
 				//interpret the pixel as an ID