You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
99 lines
2.5 KiB
HTML
99 lines
2.5 KiB
HTML
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8" />
|
|
<base href="../../../" />
|
|
<script src="page.js"></script>
|
|
<link type="text/css" rel="stylesheet" href="page.css" />
|
|
</head>
|
|
<body>
|
|
[page:Texture] →
|
|
|
|
<h1>[name]</h1>
|
|
|
|
<p class="desc">
|
|
This class can only be used in combination with
|
|
[page:WebGLRenderer.copyFramebufferToTexture]().
|
|
</p>
|
|
|
|
<code>
|
|
const pixelRatio = window.devicePixelRatio;
|
|
const textureSize = 128 * pixelRatio;
|
|
|
|
// instantiate a framebuffer texture
|
|
const frameTexture = new FramebufferTexture( textureSize, textureSize );
|
|
|
|
// calculate start position for copying part of the frame data
|
|
const vector = new Vector2();
|
|
vector.x = ( window.innerWidth * pixelRatio / 2 ) - ( textureSize / 2 );
|
|
vector.y = ( window.innerHeight * pixelRatio / 2 ) - ( textureSize / 2 );
|
|
|
|
// render the scene
|
|
renderer.clear();
|
|
renderer.render( scene, camera );
|
|
|
|
// copy part of the rendered frame into the framebuffer texture
|
|
renderer.copyFramebufferToTexture( frameTexture, vector );
|
|
</code>
|
|
|
|
<h2>Examples</h2>
|
|
|
|
<p>[example:webgl_framebuffer_texture]</p>
|
|
|
|
<h2>Constructor</h2>
|
|
|
|
<h3>
|
|
[name]( [param:Number width], [param:Number height] )
|
|
</h3>
|
|
<p>
|
|
[page:Number width] -- The width of the texture.<br />
|
|
|
|
[page:Number height] -- The height of the texture.
|
|
</p>
|
|
|
|
<h2>Properties</h2>
|
|
|
|
<p>See the base [page:Texture Texture] class for common properties.</p>
|
|
|
|
<h3>[property:Boolean generateMipmaps]</h3>
|
|
<p>Whether to generate mipmaps for the [name]. Default value is `false`.</p>
|
|
|
|
<h3>[property:Boolean isFramebufferTexture]</h3>
|
|
<p>Read-only flag to check if a given object is of type [name].</p>
|
|
|
|
<h3>[property:number magFilter]</h3>
|
|
<p>
|
|
How the texture is sampled when a texel covers more than one pixel. The
|
|
default is [page:Textures THREE.NearestFilter], which uses the value of
|
|
the closest texel.
|
|
<br /><br />
|
|
|
|
See [page:Textures texture constants] for details.
|
|
</p>
|
|
|
|
<h3>[property:number minFilter]</h3>
|
|
<p>
|
|
How the texture is sampled when a texel covers less than one pixel. The
|
|
default is [page:Textures THREE.NearestFilter], which uses the value of
|
|
the closest texel.
|
|
<br /><br />
|
|
|
|
See [page:Textures texture constants] for details.
|
|
</p>
|
|
|
|
<h3>[property:Boolean needsUpdate]</h3>
|
|
|
|
<p>True by default. This is required so that the canvas data is loaded.</p>
|
|
|
|
<h2>Methods</h2>
|
|
|
|
<p>See the base [page:Texture Texture] class for common methods.</p>
|
|
|
|
<h2>Source</h2>
|
|
|
|
<p>
|
|
[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
|
|
</p>
|
|
</body>
|
|
</html>
|