WebGLRenderer.html 22.7 KB
Newer Older
1 2 3
<!DOCTYPE html>
<html lang="en">
	<head>
D
dubejf 已提交
4
		<meta charset="utf-8" />
M
Mr.doob 已提交
5
		<base href="../../../" />
M
Mr.doob 已提交
6 7 8
		<script src="list.js"></script>
		<script src="page.js"></script>
		<link type="text/css" rel="stylesheet" href="page.css" />
9 10 11
	</head>
	<body>
		<h1>[name]</h1>
M
Mr.doob 已提交
12

13
		<p class="desc">
L
Lewy Blue 已提交
14 15
			The WebGL renderer displays your beautifully crafted scenes using
			[link:https://en.wikipedia.org/wiki/WebGL WebGL].
16
		</p>
M
Mr.doob 已提交
17

18
		<h2>Constructor</h2>
M
Mr.doob 已提交
19

20
		<h3>[name]( [param:Object parameters] )</h3>
21
		<p>
L
Lewy Blue 已提交
22
		[page:Object parameters] - (optional) object with properties defining the renderer's behaviour.
23
			The constructor also accepts no parameters at all. In all cases, it will assume sane defaults
L
Lewy Blue 已提交
24 25 26 27 28 29
			when parameters are missing. The following are valid parameters:<br /><br />

		[page:DOMElement canvas] - A [link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas]
		where the renderer draws its output.
		This corresponds to the [page:WebGLRenderer.domElement domElement] property below.
		If not passed in here, a new canvas element will be created.<br />
S
sole 已提交
30

31

L
Lewy Blue 已提交
32 33 34
		[page:WebGLRenderingContext context] - This can be used to attach the renderer to an existing
	  [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext].
		Default is null.<br />
35

L
Lewy Blue 已提交
36 37 38
		[page:String precision] - Shader precision. Can be *"highp"*, *"mediump"* or *"lowp"*.
		Defaults to *"highp"* if supported by the device. See the note in "Things to Avoid"
		[link:https://developer.mozilla.org/en-US/docs/Web/API/WebGL_API/WebGL_best_practices here].<br />
M
Mr.doob 已提交
39

L
Lewy Blue 已提交
40 41
		[page:Boolean alpha] - whether the canvas contains an alpha (transparency) buffer or not.
	  Default is *false*.<br />
M
Mr.doob 已提交
42

L
Lewy Blue 已提交
43 44 45
		[page:Boolean premultipliedAlpha] - whether the renderer will assume that colors have
		[link:https://en.wikipedia.org/wiki/Glossary_of_computer_graphics#Premultiplied_alpha premultiplied alpha].
		Default is *true*.<br />
S
sole 已提交
46

L
Lewy Blue 已提交
47
		[page:Boolean antialias] - whether to perform antialiasing. Default is *false*.<br />
S
sole 已提交
48

L
Lewy Blue 已提交
49 50 51
		[page:Boolean stencil] - whether the drawing buffer has a
		[link:https://en.wikipedia.org/wiki/Stencil_buffer stencil buffer] of at least 8 bits.
		Default is *true*.<br />
S
sole 已提交
52

L
Lewy Blue 已提交
53
		[page:Boolean preserveDrawingBuffer] - whether to preserve the buffers until manually cleared
54
		or overwritten. Default is *false*.<br />
55

56
		[page:String powerPreference] - Provides a hint to the user agent indicating what configuration
57 58
		of GPU is suitable for this WebGL context. Can be *"high-performance"*, *"low-power"* or *"default"*. Default is *"default"*.
		See the [link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.2 WebGL spec] for more information.<br />
S
sole 已提交
59

L
Lewy Blue 已提交
60 61 62
		[page:Boolean depth] - whether the drawing buffer has a
		[link:https://en.wikipedia.org/wiki/Z-buffering depth buffer] of at least 16 bits.
		Default is *true*.<br />
63

L
Lewy Blue 已提交
64 65 66
		[page:Boolean logarithmicDepthBuffer] -  whether to use a logarithmic depth buffer. It may
		be neccesary to use this if dealing with huge differences in scale in a single scene.
		Default is *false*. See the [example:webgl_camera_logarithmicdepthbuffer camera / logarithmicdepthbuffer] example.
67
		</p>
68 69

		<h2>Properties</h2>
S
sole 已提交
70

71
		<h3>[property:Boolean autoClear]</h3>
72
		<p>Defines whether the renderer should automatically clear its output before rendering a frame.</p>
S
sole 已提交
73 74


75
		<h3>[property:Boolean autoClearColor]</h3>
76
		<p>
L
Lewy Blue 已提交
77 78
			If [page:.autoClear autoClear] is true, defines whether the renderer should clear the color buffer.
			Default is *true*.
79
		</p>
S
sole 已提交
80 81


82
		<h3>[property:Boolean autoClearDepth]</h3>
83
		<p>
L
Lewy Blue 已提交
84 85
			If [page:.autoClear autoClear] is true, defines whether the renderer should clear the depth buffer.
			Default is *true*.
86
		</p>
S
sole 已提交
87 88


89
		<h3>[property:Boolean autoClearStencil]</h3>
90
		<p>
L
Lewy Blue 已提交
91 92
			If [page:.autoClear autoClear] is true, defines whether the renderer should clear the stencil buffer.
			Default is *true*.
93
		</p>
S
sole 已提交
94

95
		<h3>[property:Boolean debug.checkShaderErrors]</h3>
96
		<p>
97 98 99 100 101
			If [page:.checkShaderErrors checkShaderErrors] is true, defines whether material shader programs are checked
			for errors during compilation and linkage process. It may be useful to disable this check in production for performance gain.
			It is strongly recommended to keep these checks enabled during development.
			If the shader does not compile and link - it will not work and associated material will not render.
			Default is *true*.
102 103
		</p>

104
		<h3>[property:Object capabilities]</h3>
105
		<p>
106
		An object containing details about the capabilities of the current [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext].<br />
107

108
		- [page:Boolean floatFragmentTextures]: whether the context supports the [link:https://developer.mozilla.org/en-US/docs/Web/API/OES_texture_float OES_texture_float] extension.
109
			According to [link:https://webglstats.com/ WebGLStats], as of February 2016 over 95% of WebGL enabled devices support this.<br />
110 111 112 113
		- [page:Boolean floatVertexTextures]: *true* if [page:Boolean floatFragmentTextures] and [page:Boolean vertexTextures] are both true.<br />
		- [page:Method getMaxAnisotropy](): Returns the maximum available anisotropy.<br />
		- [page:Method getMaxPrecision](): Returns the maximum available precision for vertex and fragment shaders. <br />
		- [page:Boolean logarithmicDepthBuffer]: *true* if the [page:parameter logarithmicDepthBuffer] was set to true in the constructor and
114 115
		the context supports the [link:https://developer.mozilla.org/en-US/docs/Web/API/EXT_frag_depth EXT_frag_depth] extension.
			According to [link:https://webglstats.com/ WebGLStats], as of February 2016 around 66% of WebGL enabled devices support this.<br />
116 117
		- [page:Integer maxAttributes]: The value of *gl.MAX_VERTEX_ATTRIBS*.<br />
		- [page:Integer maxCubemapSize]: The value of *gl.MAX_CUBE_MAP_TEXTURE_SIZE*.
118
		Maximum height * width of cube map textures that a shader can use.<br />
119
		- [page:Integer maxFragmentUniforms]: The value of *gl.MAX_FRAGMENT_UNIFORM_VECTORS*.
120
		  The number of uniforms that can be used by a fragment shader.<br />
121
		- [page:Integer maxTextureSize]: The value of *gl.MAX_TEXTURE_SIZE*.
122
		Maximum height * width of a texture that a shader use.<br />
123
		- [page:Integer maxTextures]: The value of *gl.MAX_TEXTURE_IMAGE_UNITS*.
124
		  The maximum number of textures that can be used by a shader.<br />
125
		- [page:Integer maxVaryings]: The value of *gl.MAX_VARYING_VECTORS*.
126
		  The number of varying vectors that can used by shaders.<br />
127
		- [page:Integer maxVertexTextures]: The value of *gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS*.
128
		   The number of textures that can be used in a vertex shader.<br />
129
		- [page:Integer maxVertexUniforms]: The value of *gl.MAX_VERTEX_UNIFORM_VECTORS*.
130
		   The maximum number of uniforms that can be used in a vertex shader.<br />
131 132
		- [page:String precision]: The shader precision currently being used by the renderer.<br />
		- [page:Boolean vertexTextures]: *true* if [property:Integer maxVertexTextures] is greater than 0 (i.e. vertext textures can be used).<br />
133
		</p>
S
sole 已提交
134

135
		<h3>[property:Array clippingPlanes]</h3>
136
		<p>
137 138 139
		User-defined clipping planes specified as THREE.Plane objects in world space.
			These planes apply globally. Points in space whose dot product with the plane is negative are cut away.
		 Default is [].
140
		</p>
S
sole 已提交
141

142
		<h3>[property:WebGLRenderingContext context]</h3>
143
		<p>
144
		The renderer obtains a [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext RenderingContext] context
M
Magnuz Binder 已提交
145
		  from its [page:WebGLRenderer.domElement domElement] by default, using
J
John Barounis 已提交
146
			[link:https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext HTMLCanvasElement.getContext]().<br /><br />
S
sole 已提交
147

148 149
		You can create this manually, however it must correspond to the
		[page:WebGLRenderer.domElement domElement] in order to render to the screen.
150
		</p>
S
sole 已提交
151

152
		<h3>[property:DOMElement domElement]</h3>
153
		<p>
154 155 156 157 158 159
		A [link:https://developer.mozilla.org/en-US/docs/Web/HTML/Element/canvas canvas] where the renderer draws its output.<br />
			This is automatically created by the renderer in the constructor (if not provided already);
			you just need to add it to your page like so:<br />
		<code>
			document.body.appendChild( renderer.domElement );
		</code>
160
	  </p>
161 162

		<h3>[property:Object extensions]</h3>
163
		<p>
164 165
		A wrapper for the [page:WebGLRenderer.extensions.get .extensions.get] method, used to check whether
		various WebGL extensions are supported.
166
		</p>
S
sole 已提交
167

W
WestLangley 已提交
168
		<h3>[property:Float gammaFactor]</h3>
169
		<p>Default is *2*. </p>
T
tschw 已提交
170 171


172
		<h3>[property:Boolean gammaInput]</h3>
173
		<p>If set, then it expects that all textures and colors are premultiplied gamma. Default is *false*.</p>
T
tschw 已提交
174 175


176
		<h3>[property:Boolean gammaOutput]</h3>
177
		<p>If set, then it expects that all textures and colors need to be outputted in premultiplied gamma. Default is *false*.</p>
T
tschw 已提交
178

179
		<h3>[property:Object info]</h3>
180 181
		<p>An object with a series of statistical information about the graphics board memory and the rendering process. Useful for debugging or just for the sake of curiosity. The object contains the following fields:</p>
		<p>
182 183 184 185 186 187 188 189 190 191
		<ul>
			<li>memory:
				<ul>
					<li>geometries</li>
					<li>textures</li>
				</ul>
			</li>
			<li>render:
				<ul>
					<li>calls</li>
M
Mugen87 已提交
192
					<li>triangles</li>
193
					<li>points</li>
M
Mugen87 已提交
194
					<li>lines</li>
195 196 197 198 199
				</ul>
			</li>
			<li>programs
			</li>
		</ul>
200 201
		</p>
		<p>By default these data are reset at each render calls, but when using the composer or mirrors it can be preferred to reset them with a custom pattern :
A
Atrahasis 已提交
202 203 204 205
		<code>
		renderer.info.autoReset = false;
		renderer.info.reset();
		</code>
206
		</p>
T
tschw 已提交
207

208
		<h3>[property:Boolean localClippingEnabled]</h3>
209
		<p>Defines whether the renderer respects object-level clipping planes. Default is *false*.</p>
S
sole 已提交
210

211
		<h3>[property:Integer maxMorphTargets]</h3>
212
		<p>
213 214
		Default is 8. The maximum number of MorphTargets allowed in a shader.
			Keep in mind that the standard materials only allow 8 MorphTargets.
215
		</p>
S
sole 已提交
216

217
		<h3>[property:Integer maxMorphNormals]</h3>
218
		<p>
219 220
		Default is 4. The maximum number of MorphNormals allowed in a shader.
			Keep in mind that the standard materials only allow 4 MorphNormals.
221
		</p>
S
sole 已提交
222

223
		<h3>[property:Boolean physicallyCorrectLights]</h3>
224
		<p>
225 226
		Whether to use physically correct lighting mode. Default is *false*.
		See the [example:webgl_lights_physical lights / physical] example.
227
		</p>
S
sole 已提交
228

229
		<h3>[property:Object properties]</h3>
230
		<p>
231
		Used internally by the renderer to keep track of various sub object properties.
232
		</p>
S
sole 已提交
233

A
aardgoose 已提交
234
		<h3>[property:WebGLRenderLists renderLists]</h3>
235
		<p>
A
aardgoose 已提交
236
		Used internally to handle ordering of scene object rendering.
237
		</p>
A
aardgoose 已提交
238

239
		<h3>[property:WebGLShadowMap shadowMap]</h3>
240
		<p>
241
		This contains the reference to the shadow map, if used.
242
		</p>
S
sole 已提交
243

244
		<h3>[property:Boolean shadowMap.enabled]</h3>
245
		<p>If set, use shadow maps in the scene. Default is *false*.</p>
S
sole 已提交
246

247
		<h3>[property:Boolean shadowMap.autoUpdate]</h3>
248 249
		<p>Enables automatic updates to the shadows in the scene. Default is *true*.</p>
		<p>If you do not require dynamic lighting / shadows, you may set this to *false* when the renderer is instantiated.</p>
250 251

		<h3>[property:Boolean shadowMap.needsUpdate]</h3>
252 253
		<p>When set to *true*, shadow maps in the scene will be updated in the next *render* call. Default is *false*. </p>
		<p>If you have disabled automatic updates to shadow maps (*shadowMap.autoUpdate = false*), you will need to set this to *true* and then make a render call to update the shadows in your scene.</p>
254

255
		<h3>[property:Integer shadowMap.type]</h3>
256 257
		<p>Defines shadow map type (unfiltered, percentage close filtering, percentage close filtering with bilinear filtering in shader)</p>
		<p>Options are THREE.BasicShadowMap, THREE.PCFShadowMap (default), THREE.PCFSoftShadowMap. See [page:Renderer Renderer constants] for details.</p>
S
sole 已提交
258

259
		<h3>[property:Boolean sortObjects]</h3>
260
		<p>
261
		Defines whether the renderer should sort objects. Default is *true*.<br /><br />
S
sole 已提交
262

263 264
		Note: Sorting is used to attempt to properly render objects that have some degree of transparency.
		By definition, sorting objects may not work in all cases.  Depending on the needs of application,
265
		it may be necessary to turn off sorting and use other methods to deal with transparency
266
		rendering e.g. manually determining each object's rendering order.
267
		</p>
S
sole 已提交
268

269
		<h3>[property:Object state]</h3>
270
		<p>
271
		Contains functions for setting various properties of the [page:WebGLRenderer.context] state.
272
		</p>
S
sole 已提交
273

274
		<h3>[property:Constant toneMapping]</h3>
275
		<p>
276
		Default is [page:Renderer LinearToneMapping]. See the [page:Renderer Renderer constants] for other choices.
277
		</p>
S
sole 已提交
278

279
		<h3>[property:Number toneMappingExposure]</h3>
280
		<p>
281
		Exposure level of tone mapping. Default is *1*.
282
		</p>
S
sole 已提交
283

284
		<h3>[property:Number toneMappingWhitePoint]</h3>
285
		<p>
286
		Tone mapping white point. Default is *1*.
287
		</p>
M
Mr.doob 已提交
288

289
		<h2>Methods</h2>
M
Mr.doob 已提交
290

291
		<h3>[method:null clear]( [param:Boolean color], [param:Boolean depth], [param:Boolean stencil] )</h3>
292
		<p>
293 294 295
		Tells the renderer to clear its color, depth or stencil drawing buffer(s).
			This method initializes the color buffer to the current clear color value.<br />
		Arguments default to *true*.
296
		</p>
M
Mr.doob 已提交
297

298
		<h3>[method:null clearColor]( )</h3>
299
		<p>Clear the color buffer. Equivalent to calling [page:WebGLRenderer.clear .clear]( true, false, false ).</p>
300 301

		<h3>[method:null clearDepth]( )</h3>
302
		<p>Clear the depth buffer. Equivalent to calling [page:WebGLRenderer.clear .clear]( false, true, false ).</p>
303 304

		<h3>[method:null clearStencil]( )</h3>
305
		<p>Clear the stencil buffers. Equivalent to calling [page:WebGLRenderer.clear .clear]( false, false, true ).</p>
306

307
		<h3>[method:null compile]( [param:Scene scene], [param:Camera camera] )</h3>
308
		<p>Compiles all materials in the scene with the camera. This is useful to precompile shaders before the first rendering.</p>
M
Mr.doob 已提交
309

310
		<h3>[method:null copyFramebufferToTexture]( [param:Vector2 position], [param:Texture texture], [param:Number level] )</h3>
311
		<p>Copies pixels from the current WebGLFramebuffer into a 2D texture. Enables access to [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/copyTexImage2D WebGLRenderingContext.copyTexImage2D].</p>
312

313
		<h3>[method:null copyTextureToTexture]( [param:Vector2 position], [param:Texture srcTexture], [param:Texture dstTexture], [param:Number level] )</h3>
314
		<p>Copies all pixels of a texture to an existing texture starting from the given position. Enables access to [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/texSubImage2D WebGLRenderingContext.texSubImage2D].</p>
315

316
		<h3>[method:null dispose]( )</h3>
317
		<p>Dispose of the current rendering context.</p>
X
Xiangyun Chi 已提交
318

319
		<h3>[method:Object extensions.get]( [param:String extensionName] )</h3>
320
		<p>
321 322
		Used to check whether various extensions are supported and returns an object with details of the extension if available.
		This method can check for the following extensions:<br /><br />
X
Xiangyun Chi 已提交
323

324 325 326 327 328
		- *WEBGL_depth_texture*<br />
		- *EXT_texture_filter_anisotropic*<br />
		- *WEBGL_compressed_texture_s3tc*<br />
		- *WEBGL_compressed_texture_pvrtc*<br />
		- *WEBGL_compressed_texture_etc1*
329
		</p>
S
sole 已提交
330

331
		<h3>[method:null forceContextLoss]( )</h3>
332
		<p>
333 334 335
		Simulate loss of the WebGL context. This requires support for the
			[link:https://developer.mozilla.org/en-US/docs/Web/API/WEBGL_lose_context WEBGL_lose_context] extensions.
		According to [link:https://webglstats.com/ WebGLStats], as of February 2016 90% of WebGL enabled devices support this.
336
		</p>
S
sole 已提交
337

338
		<h3>[method:Float getClearAlpha]()</h3>
339
		<p>Returns a [page:Float float] with the current clear alpha. Ranges from 0 to 1.</p>
S
sole 已提交
340

341
		<h3>[method:Color getClearColor]()</h3>
342
		<p>Returns a [page:Color THREE.Color] instance with the current clear color.</p>
S
sole 已提交
343

344
		<h3>[method:WebGLRenderingContext getContext]()</h3>
345
		<p>Return the current WebGL context.</p>
346

347
		<h3>[method:WebGLContextAttributes getContextAttributes]()</h3>
348
		<p>Returns an object that describes the attributes set on the WebGL context when it was created.</p>
S
sole 已提交
349

350
		<h3>[method:RenderTarget getRenderTarget]()</h3>
F
FMS-Cat 已提交
351
		<p>Returns the current [page:RenderTarget RenderTarget] if there are; returns *null* otherwise.</p>
S
sole 已提交
352

353 354 355 356 357 358
		<h3>[method:Vector4 getCurrentViewport]( [param:Vector4 target] )</h3>
		<p>
		[page:Vector4 target] — the result will be copied into this Vector4.<br /><br />

		Returns the current viewport.
		</p>
M
Mugen87 已提交
359

360 361 362 363 364 365
		<h3>[method:Vector2 getDrawingBufferSize]( [param:Vector2 target] )</h3>
		<p>
		[page:Vector2 target] — the result will be copied into this Vector2.<br /><br />

		Returns the width and height of the renderer's drawing buffer, in pixels.
		</p>
366

367
		<h3>[method:number getPixelRatio]()</h3>
368
		<p>Returns current device pixel ratio used.</p>
S
sole 已提交
369

370 371 372 373 374 375 376 377 378 379
		<h3>[method:Vector4 getScissor]( [param:Vector4 target] )</h3>
		<p>
		[page:Vector4 target] — the result will be copied into this Vector4.<br /><br />

		Returns the scissor region.
		</p>

		<h3>[method:Boolean getScissorTest]()</h3>
		<p>Returns *true* if scissor test is enabled; returns *false* otherwise.</p>

380 381 382 383 384 385
		<h3>[method:Vector2 getSize]( [param:Vector2 target] )</h3>
		<p>
		[page:Vector2 target] — the result will be copied into this Vector2.<br /><br />

		Returns the width and height of the renderer's output canvas, in pixels.
		</p>
S
sole 已提交
386

387 388 389 390 391 392 393
		<h3>[method:Vector4 getViewport]( [param:Vector4 target] )</h3>
		<p>
		[page:Vector4 target] — the result will be copied into this Vector4.<br /><br />

		Returns the viewport.
		</p>

394
		<h3>[method:null resetGLState]( )</h3>
395
		<p>Reset the GL state to default. Called internally if the WebGL context is lost.</p>
S
sole 已提交
396

397
		<h3>[method:null readRenderTargetPixels]( [param:WebGLRenderTarget renderTarget], [param:Float x], [param:Float y], [param:Float width], [param:Float height], [param:TypedArray buffer], [param:Integer activeCubeFaceIndex] )</h3>
A
aardgoose 已提交
398 399
		<p>buffer - Uint8Array is the only destination type supported in all cases, other types are renderTarget and platform dependent. See [link:https://www.khronos.org/registry/webgl/specs/latest/1.0/#5.14.12 WebGL spec] for details.</p>
		<p>Reads the pixel data from the renderTarget into the buffer you pass in. This is a wrapper around [link:https://developer.mozilla.org/en-US/docs/Web/API/WebGLRenderingContext/readPixels WebGLRenderingContext.readPixels]().</p>
400 401
		<p>See the [example:webgl_interactive_cubes_gpu interactive / cubes / gpu] example.</p>
		<p>For reading out a [page:WebGLRenderTargetCube WebGLRenderTargetCube] use the optional parameter activeCubeFaceIndex to determine which face should be read.</p>
S
sole 已提交
402

A
aardgoose 已提交
403

404
		<h3>[method:null render]( [param:Scene scene], [param:Camera camera] )</h3>
405
		<p>
406
			Render a [page:Scene scene] using a [page:Camera camera].<br />
S
sole 已提交
407

408
			The render is done to a previously specified [page:WebGLRenderTarget renderTarget] set by calling [page:WebGLRenderer.setRenderTarget .setRenderTarget] or to the canvas as usual.<br />
S
sole 已提交
409

410 411 412
			By default render buffers are cleared before rendering but you can prevent this by setting the property [page:WebGLRenderer.autoClear autoClear] to false.
			If you want to prevent only certain buffers being cleared you can set either the [page:WebGLRenderer.autoClearColor autoClearColor], [page:WebGLRenderer.autoClearStencil autoClearStencil] or
			[page:WebGLRenderer.autoClearDepth autoClearDepth] properties to false. To forcibly clear one ore more buffers call [page:WebGLRenderer.clear .clear].
413
		</p>
S
sole 已提交
414

M
Michael Herzog 已提交
415
		<h3>[method:null renderBufferDirect]( [param:Camera camera], [param:Fog fog], [param:Geometry geometry], [param:Material material], [param:Object3D object], [param:Object group] )</h3>
416
		<p>Render a buffer geometry group using the camera and with the specified material.</p>
S
sole 已提交
417

418
		<h3>[method:null renderBufferImmediate]( [param:Object3D object], [param:shaderprogram program], [param:Material shading] )</h3>
419
		<p>object - an instance of [page:Object3D]<br />
L
Lewy Blue 已提交
420 421
		program - an instance of shaderProgram<br />
		shading - an instance of Material<br /><br />
S
sole 已提交
422

423
		Render an immediate buffer. Gets called by renderImmediateObject.
424
		</p>
425

426 427 428 429
		<h3>[method:null setAnimationLoop]( [param:Function callback] )</h3>
		<p>[page:Function callback] — The function will be called every available frame. If `null` is passed it will stop any already ongoing animation.</p>
		<p>A build in function that can be used instead of [link:https://developer.mozilla.org/en-US/docs/Web/API/window/requestAnimationFrame requestAnimationFrame]. For WebVR projects this function must be used.</p>

430
		<h3>[method:null setClearAlpha]( [param:Float alpha] )</h3>
431
		<p>Sets the clear alpha. Valid input is a float between *0.0* and *1.0*.</p>
S
sole 已提交
432

433
		<h3>[method:null setClearColor]( [param:Color color], [param:Float alpha] )</h3>
434
		<p>Sets the clear color and opacity.</p>
S
sole 已提交
435

436
		<h3>[method:null setPixelRatio]( [param:number value] )</h3>
437
		<p>Sets device pixel ratio. This is usually used for HiDPI device to prevent bluring output canvas.</p>
438

439
		<h3>[method:null setRenderTarget]( [param:WebGLRenderTarget renderTarget], [param:Integer activeCubeFace], [param:Integer activeMipMapLevel] )</h3>
440
		<p>
F
FMS-Cat 已提交
441
		renderTarget -- The [page:WebGLRenderTarget renderTarget] that needs to be activated. When *null* is given, the canvas is set as the active render target instead.<br />
442 443
		activeCubeFace -- Specifies the active cube side (PX 0, NX 1, PY 2, NY 3, PZ 4, NZ 5) of [page:WebGLRenderTargetCube] (optional).<br />
		activeMipMapLevel -- Specifies the active mipmap level (optional).<br /><br />
F
FMS-Cat 已提交
444
		This method sets the active rendertarget.
445
		</p>
M
Mr.doob 已提交
446

447 448 449
		<h3>[method:null setScissor]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )<br />
		[method:null setScissor]( [param:Vector4 vector] )</h3>

450
		<p>
451 452 453 454 455
		The x, y, width, and height parameters of the scissor region.<br />
		Optionally, a 4-component vector specifying the parameters of the region.<br /><br />

		Sets the scissor region from (x, y) to (x + width, y + height).<br />
		(x, y) is the lower-left corner of the scissor region.
456
		</p>
C
cjshannon 已提交
457

458
		<h3>[method:null setScissorTest]( [param:Boolean boolean] )</h3>
459
		<p>
M
Mr.doob 已提交
460 461
		Enable or disable the scissor test. When this is enabled, only the pixels within the defined
			scissor area will be affected by further renderer actions.
462
		</p>
C
cjshannon 已提交
463

464
		<h3>[method:null setSize]( [param:Integer width], [param:Integer height], [param:Boolean updateStyle] )</h3>
465
		<p>
466 467
		Resizes the output canvas to (width, height) with device pixel ratio taken into account,
			and also sets the viewport to fit that size, starting in (0, 0).
468
			Setting [page:Boolean updateStyle] to false prevents any style changes to the output canvas.
469
		</p>
C
cjshannon 已提交
470

471 472 473 474 475 476 477 478 479 480
		<h3>[method:null setViewport]( [param:Integer x], [param:Integer y], [param:Integer width], [param:Integer height] )<br />
		[method:null setViewport]( [param:Vector4 vector] )</h3>

		<p>
		The x, y, width, and height parameters of the viewport.<br />
		Optionally, a 4-component vector specifying the parameters of a viewport.<br /><br />

		Sets the viewport to render from (x, y) to (x + width, y + height).<br />
		(x, y) is the lower-left corner of the region.
		</p>
481

482
		<h2>Source</h2>
M
Mr.doob 已提交
483

484 485 486
		[link:https://github.com/mrdoob/three.js/blob/master/src/[path].js src/[path].js]
	</body>
</html>