forked from mrdoob/three.js
-
Notifications
You must be signed in to change notification settings - Fork 0
WebGLRenderer
alteredq edited this page Aug 22, 2011
·
4 revisions
The WebGLRenderer class provides all of the functionality needed to handle objects and render scenes.
new THREE.WebGLRenderer({
antialias: false,
canvas: document.createElement( 'canvas' ),
clearColor: 0x000000,
clearAlpha: 0,
maxLights: 4,
stencil: true,
preserveDrawingBuffer: false
});
-
antialiasspecifies whether or not antialiasing is enabled -
canvasif specified, the renderer will use this HTMLCanvasElement instead of creating a new one -
clearColordefines the background color the scene will render with -
clearAlphadefines the opacity of the scene's background color, range 0.0 (invisible) to 1.0 (opaque) -
maxLightsspecifies how many total lights are allowed in the scene (divided evenly between point & directional lights) -
stencilspecifies if the WebGL context should enable the stencil buffer -
preserveDrawingBufferkeep drawing buffer content after return from render function (see WebGL specs)
-
dataholds information on the number of vertices and faces drawn in how many draw calls -
maxMorphTargetsthe maximum number of morph targets a material can have -
autoClearspecifies whether each call torender()will clear the canvas before rendering -
sortObjectsif true, objects are sorted by their Z position before drawing
-
clear()clears the canvas's color, depth, and stencil buffers -
enableDepthBufferWrite(enable)true/false, enables or disables writing to the depth buffer -
enableScissorTest(enable)true/false, specifies if scissor test is enabled -
getContext()returns the canvas's 3D context -
render(scene, camera, renderTarget, forceClear)renderssceneas viewed bycameraonto the canvas element. If supplied,renderTargetmust be a THREE.WebGLRenderTarget object which will be rendererd onto instead of painting the canvas element. IfforceClearis true then the canvas is cleared regardness of theautoClearvalue. -
setClearColor(color, alpha)updates the canvas's clearColor RGBA values -
setClearColorHex(hex, alpha)updates the canvas's clearColor RGBA values -
setFaceCulling(cullFace, frontFace)ifcullFaceis not false, the face it specifies will be culled.cullFacevalues are "front" or "back", ifcullFaceis not false, "front", or "back" then both faces are culled.frontFacevalue can be "ccw" or "cw" -
setScissor(x, y, width, height)sets area of canvas which should be scissored -
setSize(width, height)sets the canvas element's width and height and updates the context's viewport -
setViewport(x, y, width, height)changes the 3D context's viewport dimensions -
setStencilShadowDarkness(value)specifies how dark shadows generated by the stencil buffer will appear, range 0.0 (black) - 1.0 (none) -
supportsVertexTextures()returns true/false depending on GPU support of using textures in vertex shaders