FramebufferTexture.html 2.8 KB

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