FramebufferTexture.html 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8" />
  5. <base href="../../../" />
  6. <script src="page.js"></script>
  7. <link type="text/css" rel="stylesheet" href="page.css" />
  8. </head>
  9. <body>
  10. [page:Texture] &rarr;
  11. <h1>[name]</h1>
  12. <p class="desc">
  13. This class can only be used in combination with
  14. [page:WebGLRenderer.copyFramebufferToTexture]().
  15. </p>
  16. <code>
  17. const pixelRatio = window.devicePixelRatio;
  18. const textureSize = 128 * pixelRatio;
  19. // instantiate a framebuffer texture
  20. const frameTexture = new FramebufferTexture( textureSize, textureSize );
  21. // calculate start position for copying part of the frame data
  22. const vector = new Vector2();
  23. vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
  24. vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
  25. // render the scene
  26. renderer.clear();
  27. renderer.render( scene, camera );
  28. // copy part of the rendered frame into the framebuffer texture
  29. renderer.copyFramebufferToTexture( frameTexture, vector );
  30. </code>
  31. <h2>Examples</h2>
  32. <p>[example:webgl_framebuffer_texture]</p>
  33. <h2>Constructor</h2>
  34. <h3>
  35. [name]( [param:Number width], [param:Number height] )
  36. </h3>
  37. <p>
  38. [page:Number width] -- The width of the texture.<br />
  39. [page:Number height] -- The height of the texture.
  40. </p>
  41. <h2>Properties</h2>
  42. <p>See the base [page:Texture Texture] class for common properties.</p>
  43. <h3>[property:Boolean generateMipmaps]</h3>
  44. <p>Whether to generate mipmaps for the [name]. Default value is `false`.</p>
  45. <h3>[property:Boolean isFramebufferTexture]</h3>
  46. <p>Read-only flag to check if a given object is of type [name].</p>
  47. <h3>[property:number magFilter]</h3>
  48. <p>
  49. How the texture is sampled when a texel covers more than one pixel. The
  50. default is [page:Textures THREE.NearestFilter], which uses the value of
  51. the closest texel.
  52. <br /><br />
  53. See [page:Textures texture constants] for details.
  54. </p>
  55. <h3>[property:number minFilter]</h3>
  56. <p>
  57. How the texture is sampled when a texel covers less than one pixel. The
  58. default is [page:Textures THREE.NearestFilter], which uses the value of
  59. the closest texel.
  60. <br /><br />
  61. See [page:Textures texture constants] for details.
  62. </p>
  63. <h3>[property:Boolean needsUpdate]</h3>
  64. <p>True by default. This is required so that the canvas data is loaded.</p>
  65. <h2>Methods</h2>
  66. <p>See the base [page:Texture Texture] class for common methods.</p>
  67. <h2>Source</h2>
  68. <p>
  69. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  70. </p>
  71. </body>
  72. </html>