FramebufferTexture.html 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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, RGBAFormat );
  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( vector, frameTexture );
  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], [param:Constant format] )
  36. </h3>
  37. <p>
  38. [page:Number width] -- The width of the texture.<br />
  39. [page:Number height] -- The height of the texture.<br />
  40. [page:Constant format] -- The format used in the texture. See
  41. [page:Textures format constants] for other choices.<br />
  42. </p>
  43. <h2>Properties</h2>
  44. <p>See the base [page:Texture Texture] class for common properties.</p>
  45. <h3>[property:Boolean generateMipmaps]</h3>
  46. <p>Whether to generate mipmaps for the [name]. Default value is `false`.</p>
  47. <h3>[property:Boolean isFramebufferTexture]</h3>
  48. <p>Read-only flag to check if a given object is of type [name].</p>
  49. <h3>[property:number magFilter]</h3>
  50. <p>
  51. How the texture is sampled when a texel covers more than one pixel. The
  52. default is [page:Textures THREE.NearestFilter], which uses the value of
  53. the closest texel.
  54. <br /><br />
  55. See [page:Textures texture constants] for details.
  56. </p>
  57. <h3>[property:number minFilter]</h3>
  58. <p>
  59. How the texture is sampled when a texel covers less than one pixel. The
  60. default is [page:Textures THREE.NearestFilter], which uses the value of
  61. the closest texel.
  62. <br /><br />
  63. See [page:Textures texture constants] for details.
  64. </p>
  65. <h3>[property:Boolean needsUpdate]</h3>
  66. <p>True by default. This is required so that the canvas data is loaded.</p>
  67. <h2>Methods</h2>
  68. <p>See the base [page:Texture Texture] class for common methods.</p>
  69. <h2>Source</h2>
  70. <p>
  71. [link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
  72. </p>
  73. </body>
  74. </html>