@aidinabedi/playcanvas
Version:
PlayCanvas WebGL game engine
808 lines (752 loc) • 81.4 kB
HTML
<!doctype html>
<html lang="en">
<head>
<title>pc.GraphicsDevice | PlayCanvas API Reference</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link rel="icon" type="image/png" href="images/playcanvas-favicon.png">
<link href="styles/styles.css" rel="stylesheet">
<link href="styles/playcanvas-theme.css" rel="stylesheet">
<script src="scripts/interface.js"></script>
<script src="scripts/highlight.min.js"></script>
<script>hljs.initHighlightingOnLoad();</script>
</head>
<body>
<header>
<nav class="header-width">
<a href="/" class="header-title"><img src="images/playcanvas-manual.png"></a>
<ul class="header-menu">
<li class="user-manual"><a href="https://developer.playcanvas.com/en/user-manual/">User Manual</a></li>
<li class="tutorials"><a href="https://developer.playcanvas.com/en/tutorials">Tutorials</a></li>
<li class="forum"><a href="https://forum.playcanvas.com/" target="_blank">Forum</a></li>
<li class="api active"><a href="/api/">API Reference</a></li>
</ul>
</nav>
<div class="header-content header-page header-width">
<h1><span class="font-icon"></span>API Reference</h1>
<input id="search" class="search" type="text" placeholder="Search"></input>
</div>
</header>
<div class="container content-width">
<nav class="sidebar">
<div class="sidebarFilter">
<input id="filter-input" type="text" placeholder="Filter">
</div>
<ul>
<li id="nav-pc"><a href="pc.html">pc</a></li>
<li id="nav-pc.callbacks"><a href="pc.callbacks.html">pc.callbacks</a></li>
<li id="nav-pc.guid"><a href="pc.guid.html">pc.guid</a></li>
<li id="nav-pc.math"><a href="pc.math.html">pc.math</a></li>
<li id="nav-pc.path"><a href="pc.path.html">pc.path</a></li>
<li id="nav-pc.platform"><a href="pc.platform.html">pc.platform</a></li>
<li id="nav-pc.script"><a href="pc.script.html">pc.script</a></li>
<li id="nav-pc.string"><a href="pc.string.html">pc.string</a></li>
<li id="nav-pc.Animation"><a href="pc.Animation.html">Animation</a></li>
<li id="nav-pc.AnimationComponent"><a href="pc.AnimationComponent.html">AnimationComponent</a></li>
<li id="nav-pc.AnimationComponentSystem"><a href="pc.AnimationComponentSystem.html">AnimationComponentSystem</a></li>
<li id="nav-pc.AnimationHandler"><a href="pc.AnimationHandler.html">AnimationHandler</a></li>
<li id="nav-pc.AnimCache"><a href="pc.AnimCache.html">AnimCache</a></li>
<li id="nav-pc.AnimClip"><a href="pc.AnimClip.html">AnimClip</a></li>
<li id="nav-pc.AnimController"><a href="pc.AnimController.html">AnimController</a></li>
<li id="nav-pc.AnimCurve"><a href="pc.AnimCurve.html">AnimCurve</a></li>
<li id="nav-pc.AnimData"><a href="pc.AnimData.html">AnimData</a></li>
<li id="nav-pc.AnimSnapshot"><a href="pc.AnimSnapshot.html">AnimSnapshot</a></li>
<li id="nav-pc.AnimTarget"><a href="pc.AnimTarget.html">AnimTarget</a></li>
<li id="nav-pc.AnimTrack"><a href="pc.AnimTrack.html">AnimTrack</a></li>
<li id="nav-pc.Application"><a href="pc.Application.html">Application</a></li>
<li id="nav-pc.Asset"><a href="pc.Asset.html">Asset</a></li>
<li id="nav-pc.AssetReference"><a href="pc.AssetReference.html">AssetReference</a></li>
<li id="nav-pc.AssetRegistry"><a href="pc.AssetRegistry.html">AssetRegistry</a></li>
<li id="nav-pc.AudioHandler"><a href="pc.AudioHandler.html">AudioHandler</a></li>
<li id="nav-pc.AudioListenerComponent"><a href="pc.AudioListenerComponent.html">AudioListenerComponent</a></li>
<li id="nav-pc.AudioListenerComponentSystem"><a href="pc.AudioListenerComponentSystem.html">AudioListenerComponentSystem</a></li>
<li id="nav-pc.BasicMaterial"><a href="pc.BasicMaterial.html">BasicMaterial</a></li>
<li id="nav-pc.Batch"><a href="pc.Batch.html">Batch</a></li>
<li id="nav-pc.BatchGroup"><a href="pc.BatchGroup.html">BatchGroup</a></li>
<li id="nav-pc.BatchManager"><a href="pc.BatchManager.html">BatchManager</a></li>
<li id="nav-pc.BoundingBox"><a href="pc.BoundingBox.html">BoundingBox</a></li>
<li id="nav-pc.BoundingSphere"><a href="pc.BoundingSphere.html">BoundingSphere</a></li>
<li id="nav-pc.ButtonComponent"><a href="pc.ButtonComponent.html">ButtonComponent</a></li>
<li id="nav-pc.ButtonComponentSystem"><a href="pc.ButtonComponentSystem.html">ButtonComponentSystem</a></li>
<li id="nav-pc.CameraComponent"><a href="pc.CameraComponent.html">CameraComponent</a></li>
<li id="nav-pc.CameraComponentSystem"><a href="pc.CameraComponentSystem.html">CameraComponentSystem</a></li>
<li id="nav-pc.CollisionComponent"><a href="pc.CollisionComponent.html">CollisionComponent</a></li>
<li id="nav-pc.CollisionComponentSystem"><a href="pc.CollisionComponentSystem.html">CollisionComponentSystem</a></li>
<li id="nav-pc.Color"><a href="pc.Color.html">Color</a></li>
<li id="nav-pc.Component"><a href="pc.Component.html">Component</a></li>
<li id="nav-pc.ComponentSystem"><a href="pc.ComponentSystem.html">ComponentSystem</a></li>
<li id="nav-pc.ComponentSystemRegistry"><a href="pc.ComponentSystemRegistry.html">ComponentSystemRegistry</a></li>
<li id="nav-pc.ContactPoint"><a href="pc.ContactPoint.html">ContactPoint</a></li>
<li id="nav-pc.ContactResult"><a href="pc.ContactResult.html">ContactResult</a></li>
<li id="nav-pc.ContainerHandler"><a href="pc.ContainerHandler.html">ContainerHandler</a></li>
<li id="nav-pc.ContainerResource"><a href="pc.ContainerResource.html">ContainerResource</a></li>
<li id="nav-pc.Controller"><a href="pc.Controller.html">Controller</a></li>
<li id="nav-pc.CubemapHandler"><a href="pc.CubemapHandler.html">CubemapHandler</a></li>
<li id="nav-pc.Curve"><a href="pc.Curve.html">Curve</a></li>
<li id="nav-pc.CurveSet"><a href="pc.CurveSet.html">CurveSet</a></li>
<li id="nav-pc.ElementComponent"><a href="pc.ElementComponent.html">ElementComponent</a></li>
<li id="nav-pc.ElementComponentSystem"><a href="pc.ElementComponentSystem.html">ElementComponentSystem</a></li>
<li id="nav-pc.ElementDragHelper"><a href="pc.ElementDragHelper.html">ElementDragHelper</a></li>
<li id="nav-pc.ElementInput"><a href="pc.ElementInput.html">ElementInput</a></li>
<li id="nav-pc.ElementInputEvent"><a href="pc.ElementInputEvent.html">ElementInputEvent</a></li>
<li id="nav-pc.ElementMouseEvent"><a href="pc.ElementMouseEvent.html">ElementMouseEvent</a></li>
<li id="nav-pc.ElementTouchEvent"><a href="pc.ElementTouchEvent.html">ElementTouchEvent</a></li>
<li id="nav-pc.Entity"><a href="pc.Entity.html">Entity</a></li>
<li id="nav-pc.EventHandler"><a href="pc.EventHandler.html">EventHandler</a></li>
<li id="nav-pc.Font"><a href="pc.Font.html">Font</a></li>
<li id="nav-pc.FontHandler"><a href="pc.FontHandler.html">FontHandler</a></li>
<li id="nav-pc.ForwardRenderer"><a href="pc.ForwardRenderer.html">ForwardRenderer</a></li>
<li id="nav-pc.Frustum"><a href="pc.Frustum.html">Frustum</a></li>
<li id="nav-pc.GamePads"><a href="pc.GamePads.html">GamePads</a></li>
<li id="nav-pc.GraphicsDevice"><a href="pc.GraphicsDevice.html">GraphicsDevice</a></li>
<li id="nav-pc.GraphNode"><a href="pc.GraphNode.html">GraphNode</a></li>
<li id="nav-pc.Http"><a href="pc.Http.html">Http</a></li>
<li id="nav-pc.I18n"><a href="pc.I18n.html">I18n</a></li>
<li id="nav-pc.IndexBuffer"><a href="pc.IndexBuffer.html">IndexBuffer</a></li>
<li id="nav-pc.Keyboard"><a href="pc.Keyboard.html">Keyboard</a></li>
<li id="nav-pc.KeyboardEvent"><a href="pc.KeyboardEvent.html">KeyboardEvent</a></li>
<li id="nav-pc.Layer"><a href="pc.Layer.html">Layer</a></li>
<li id="nav-pc.LayerComposition"><a href="pc.LayerComposition.html">LayerComposition</a></li>
<li id="nav-pc.LayoutChildComponent"><a href="pc.LayoutChildComponent.html">LayoutChildComponent</a></li>
<li id="nav-pc.LayoutChildComponentSystem"><a href="pc.LayoutChildComponentSystem.html">LayoutChildComponentSystem</a></li>
<li id="nav-pc.LayoutGroupComponent"><a href="pc.LayoutGroupComponent.html">LayoutGroupComponent</a></li>
<li id="nav-pc.LayoutGroupComponentSystem"><a href="pc.LayoutGroupComponentSystem.html">LayoutGroupComponentSystem</a></li>
<li id="nav-pc.LightComponent"><a href="pc.LightComponent.html">LightComponent</a></li>
<li id="nav-pc.LightComponentSystem"><a href="pc.LightComponentSystem.html">LightComponentSystem</a></li>
<li id="nav-pc.Lightmapper"><a href="pc.Lightmapper.html">Lightmapper</a></li>
<li id="nav-pc.Mat3"><a href="pc.Mat3.html">Mat3</a></li>
<li id="nav-pc.Mat4"><a href="pc.Mat4.html">Mat4</a></li>
<li id="nav-pc.Material"><a href="pc.Material.html">Material</a></li>
<li id="nav-pc.MaterialHandler"><a href="pc.MaterialHandler.html">MaterialHandler</a></li>
<li id="nav-pc.Mesh"><a href="pc.Mesh.html">Mesh</a></li>
<li id="nav-pc.MeshInstance"><a href="pc.MeshInstance.html">MeshInstance</a></li>
<li id="nav-pc.Model"><a href="pc.Model.html">Model</a></li>
<li id="nav-pc.ModelComponent"><a href="pc.ModelComponent.html">ModelComponent</a></li>
<li id="nav-pc.ModelComponentSystem"><a href="pc.ModelComponentSystem.html">ModelComponentSystem</a></li>
<li id="nav-pc.ModelHandler"><a href="pc.ModelHandler.html">ModelHandler</a></li>
<li id="nav-pc.Morph"><a href="pc.Morph.html">Morph</a></li>
<li id="nav-pc.MorphInstance"><a href="pc.MorphInstance.html">MorphInstance</a></li>
<li id="nav-pc.MorphTarget"><a href="pc.MorphTarget.html">MorphTarget</a></li>
<li id="nav-pc.Mouse"><a href="pc.Mouse.html">Mouse</a></li>
<li id="nav-pc.MouseEvent"><a href="pc.MouseEvent.html">MouseEvent</a></li>
<li id="nav-pc.Node"><a href="pc.Node.html">Node</a></li>
<li id="nav-pc.OrientedBox"><a href="pc.OrientedBox.html">OrientedBox</a></li>
<li id="nav-pc.ParticleSystemComponent"><a href="pc.ParticleSystemComponent.html">ParticleSystemComponent</a></li>
<li id="nav-pc.ParticleSystemComponentSystem"><a href="pc.ParticleSystemComponentSystem.html">ParticleSystemComponentSystem</a></li>
<li id="nav-pc.Picker"><a href="pc.Picker.html">Picker</a></li>
<li id="nav-pc.PostEffect"><a href="pc.PostEffect.html">PostEffect</a></li>
<li id="nav-pc.PostEffectQueue"><a href="pc.PostEffectQueue.html">PostEffectQueue</a></li>
<li id="nav-pc.Quat"><a href="pc.Quat.html">Quat</a></li>
<li id="nav-pc.Ray"><a href="pc.Ray.html">Ray</a></li>
<li id="nav-pc.RaycastResult"><a href="pc.RaycastResult.html">RaycastResult</a></li>
<li id="nav-pc.RenderTarget"><a href="pc.RenderTarget.html">RenderTarget</a></li>
<li id="nav-pc.ResourceHandler"><a href="pc.ResourceHandler.html">ResourceHandler</a></li>
<li id="nav-pc.ResourceLoader"><a href="pc.ResourceLoader.html">ResourceLoader</a></li>
<li id="nav-pc.RigidBodyComponent"><a href="pc.RigidBodyComponent.html">RigidBodyComponent</a></li>
<li id="nav-pc.RigidBodyComponentSystem"><a href="pc.RigidBodyComponentSystem.html">RigidBodyComponentSystem</a></li>
<li id="nav-pc.Scene"><a href="pc.Scene.html">Scene</a></li>
<li id="nav-pc.SceneHandler"><a href="pc.SceneHandler.html">SceneHandler</a></li>
<li id="nav-pc.ScopeId"><a href="pc.ScopeId.html">ScopeId</a></li>
<li id="nav-pc.ScopeSpace"><a href="pc.ScopeSpace.html">ScopeSpace</a></li>
<li id="nav-pc.ScreenComponent"><a href="pc.ScreenComponent.html">ScreenComponent</a></li>
<li id="nav-pc.ScreenComponentSystem"><a href="pc.ScreenComponentSystem.html">ScreenComponentSystem</a></li>
<li id="nav-pc.ScriptAttributes"><a href="pc.ScriptAttributes.html">ScriptAttributes</a></li>
<li id="nav-pc.ScriptComponent"><a href="pc.ScriptComponent.html">ScriptComponent</a></li>
<li id="nav-pc.ScriptComponentSystem"><a href="pc.ScriptComponentSystem.html">ScriptComponentSystem</a></li>
<li id="nav-pc.ScriptHandler"><a href="pc.ScriptHandler.html">ScriptHandler</a></li>
<li id="nav-pc.ScriptRegistry"><a href="pc.ScriptRegistry.html">ScriptRegistry</a></li>
<li id="nav-pc.ScriptType"><a href="pc.ScriptType.html">ScriptType</a></li>
<li id="nav-pc.ScrollbarComponent"><a href="pc.ScrollbarComponent.html">ScrollbarComponent</a></li>
<li id="nav-pc.ScrollbarComponentSystem"><a href="pc.ScrollbarComponentSystem.html">ScrollbarComponentSystem</a></li>
<li id="nav-pc.ScrollViewComponent"><a href="pc.ScrollViewComponent.html">ScrollViewComponent</a></li>
<li id="nav-pc.ScrollViewComponentSystem"><a href="pc.ScrollViewComponentSystem.html">ScrollViewComponentSystem</a></li>
<li id="nav-pc.Shader"><a href="pc.Shader.html">Shader</a></li>
<li id="nav-pc.SingleContactResult"><a href="pc.SingleContactResult.html">SingleContactResult</a></li>
<li id="nav-pc.Skeleton"><a href="pc.Skeleton.html">Skeleton</a></li>
<li id="nav-pc.Skin"><a href="pc.Skin.html">Skin</a></li>
<li id="nav-pc.SkinInstance"><a href="pc.SkinInstance.html">SkinInstance</a></li>
<li id="nav-pc.Sound"><a href="pc.Sound.html">Sound</a></li>
<li id="nav-pc.SoundComponent"><a href="pc.SoundComponent.html">SoundComponent</a></li>
<li id="nav-pc.SoundComponentSystem"><a href="pc.SoundComponentSystem.html">SoundComponentSystem</a></li>
<li id="nav-pc.SoundInstance"><a href="pc.SoundInstance.html">SoundInstance</a></li>
<li id="nav-pc.SoundInstance3d"><a href="pc.SoundInstance3d.html">SoundInstance3d</a></li>
<li id="nav-pc.SoundManager"><a href="pc.SoundManager.html">SoundManager</a></li>
<li id="nav-pc.SoundSlot"><a href="pc.SoundSlot.html">SoundSlot</a></li>
<li id="nav-pc.Sprite"><a href="pc.Sprite.html">Sprite</a></li>
<li id="nav-pc.SpriteAnimationClip"><a href="pc.SpriteAnimationClip.html">SpriteAnimationClip</a></li>
<li id="nav-pc.SpriteComponent"><a href="pc.SpriteComponent.html">SpriteComponent</a></li>
<li id="nav-pc.SpriteComponentSystem"><a href="pc.SpriteComponentSystem.html">SpriteComponentSystem</a></li>
<li id="nav-pc.SpriteHandler"><a href="pc.SpriteHandler.html">SpriteHandler</a></li>
<li id="nav-pc.StandardMaterial"><a href="pc.StandardMaterial.html">StandardMaterial</a></li>
<li id="nav-pc.StencilParameters"><a href="pc.StencilParameters.html">StencilParameters</a></li>
<li id="nav-pc.Tags"><a href="pc.Tags.html">Tags</a></li>
<li id="nav-pc.Texture"><a href="pc.Texture.html">Texture</a></li>
<li id="nav-pc.TextureAtlas"><a href="pc.TextureAtlas.html">TextureAtlas</a></li>
<li id="nav-pc.TextureAtlasHandler"><a href="pc.TextureAtlasHandler.html">TextureAtlasHandler</a></li>
<li id="nav-pc.TextureHandler"><a href="pc.TextureHandler.html">TextureHandler</a></li>
<li id="nav-pc.Touch"><a href="pc.Touch.html">Touch</a></li>
<li id="nav-pc.TouchDevice"><a href="pc.TouchDevice.html">TouchDevice</a></li>
<li id="nav-pc.TouchEvent"><a href="pc.TouchEvent.html">TouchEvent</a></li>
<li id="nav-pc.TransformFeedback"><a href="pc.TransformFeedback.html">TransformFeedback</a></li>
<li id="nav-pc.Vec2"><a href="pc.Vec2.html">Vec2</a></li>
<li id="nav-pc.Vec3"><a href="pc.Vec3.html">Vec3</a></li>
<li id="nav-pc.Vec4"><a href="pc.Vec4.html">Vec4</a></li>
<li id="nav-pc.VertexAttributeDescription"><a href="pc.VertexAttributeDescription.html">VertexAttributeDescription</a></li>
<li id="nav-pc.VertexAttributeElement"><a href="pc.VertexAttributeElement.html">VertexAttributeElement</a></li>
<li id="nav-pc.VertexBuffer"><a href="pc.VertexBuffer.html">VertexBuffer</a></li>
<li id="nav-pc.VertexFormat"><a href="pc.VertexFormat.html">VertexFormat</a></li>
<li id="nav-pc.VertexIterator"><a href="pc.VertexIterator.html">VertexIterator</a></li>
<li id="nav-pc.VertexIteratorAccessor"><a href="pc.VertexIteratorAccessor.html">VertexIteratorAccessor</a></li>
<li id="nav-pc.XrInput"><a href="pc.XrInput.html">XrInput</a></li>
<li id="nav-pc.XrInputSource"><a href="pc.XrInputSource.html">XrInputSource</a></li>
<li id="nav-pc.XrManager"><a href="pc.XrManager.html">XrManager</a></li>
</ul>
</nav>
<div class='sidebarToggle'><span></span>Class List</div>
<main class="cls">
<h1>pc.GraphicsDevice</h1>
<p class="extends">Extends: <a href="pc.EventHandler.html">pc.EventHandler</a></p>
<p><p>The graphics device manages the underlying graphics context. It is responsible
for submitting render state changes and graphics primitives to the hardware. A graphics
device is tied to a specific canvas HTML element. It is valid to have more than one
canvas element per page and create a new graphics device against each.</p></p>
<!-- summary -->
<h1>Summary</h1>
<!--type definitions-->
<!--static properties-->
<!--static methods-->
<!--properties-->
<h3>Properties</h3>
<table class="properties">
<tr>
<td><a href="#canvas">canvas</a></td><td><p>The canvas DOM element that provides the underlying WebGL context used by the graphics device.</td>
</tr>
<tr>
<td><a href="#fullscreen">fullscreen</a></td><td><p>Fullscreen mode.</td>
</tr>
<tr>
<td><a href="#height">height</a></td><td><p>Height of the back buffer in pixels.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#maxAnisotropy">maxAnisotropy</a></td><td><p>The maximum supported texture anisotropy setting.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#maxCubeMapSize">maxCubeMapSize</a></td><td><p>The maximum supported dimension of a cube map.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#maxPixelRatio">maxPixelRatio</a></td><td><p>Maximum pixel ratio.</td>
</tr>
<tr>
<td><a href="#maxTextureSize">maxTextureSize</a></td><td><p>The maximum supported dimension of a texture.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#maxVolumeSize">maxVolumeSize</a></td><td><p>The maximum supported dimension of a 3D texture (any axis).<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#precision">precision</a></td><td><p>The highest shader precision supported by this graphics device.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#scope">scope</a></td><td><p>The scope namespace for shader attributes and variables.</td>
</tr>
<tr>
<td><a href="#supportsInstancing">supportsInstancing</a></td><td><p>True if hardware instancing is supported.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#textureFloatHighPrecision">textureFloatHighPrecision</a></td><td><p>Check if high precision floating-point textures are supported.<span class='readonly'>[read only]</span></td>
</tr>
<tr>
<td><a href="#textureFloatRenderable">textureFloatRenderable</a></td><td><p>Determines if 32-bit floating-point textures can be used as frame buffer.</td>
</tr>
<tr>
<td><a href="#textureHalfFloatRenderable">textureHalfFloatRenderable</a></td><td><p>Determines if 16-bit floating-point textures can be used as frame buffer.</td>
</tr>
<tr>
<td><a href="#width">width</a></td><td><p>Width of the back buffer in pixels.<span class='readonly'>[read only]</span></td>
</tr>
</table>
<!--methods-->
<h3>Methods</h3>
<table class="properties">
<tr>
<td><a href="#clear">clear</a></td><td><p>Clears the frame buffer of the currently set render target.</td>
</tr>
<tr>
<td><a href="#clearShaderCache">clearShaderCache</a></td><td><p>Frees memory from all shaders ever allocated with this device.</td>
</tr>
<tr>
<td><a href="#draw">draw</a></td><td><p>Submits a graphical primitive to the hardware for immediate rendering.</td>
</tr>
<tr>
<td><a href="#getBlending">getBlending</a></td><td><p>Queries whether blending is enabled.</td>
</tr>
<tr>
<td><a href="#getDepthTest">getDepthTest</a></td><td><p>Queries whether depth testing is enabled.</td>
</tr>
<tr>
<td><a href="#getDepthWrite">getDepthWrite</a></td><td><p>Queries whether writes to the depth buffer are enabled.</td>
</tr>
<tr>
<td><a href="#getRenderTarget">getRenderTarget</a></td><td><p>Queries the currently set render target on the device.</td>
</tr>
<tr>
<td><a href="#resizeCanvas">resizeCanvas</a></td><td><p>Sets the width and height of the canvas, then fires the 'resizecanvas' event.</td>
</tr>
<tr>
<td><a href="#setBlendEquation">setBlendEquation</a></td><td><p>Configures the blending equation.</td>
</tr>
<tr>
<td><a href="#setBlendEquationSeparate">setBlendEquationSeparate</a></td><td><p>Configures the blending equation.</td>
</tr>
<tr>
<td><a href="#setBlendFunction">setBlendFunction</a></td><td><p>Configures blending operations.</td>
</tr>
<tr>
<td><a href="#setBlendFunctionSeparate">setBlendFunctionSeparate</a></td><td><p>Configures blending operations.</td>
</tr>
<tr>
<td><a href="#setBlending">setBlending</a></td><td><p>Enables or disables blending.</td>
</tr>
<tr>
<td><a href="#setColorWrite">setColorWrite</a></td><td><p>Enables or disables writes to the color buffer.</td>
</tr>
<tr>
<td><a href="#setCullMode">setCullMode</a></td><td><p>Controls how triangles are culled based on their face direction.</td>
</tr>
<tr>
<td><a href="#setDepthFunc">setDepthFunc</a></td><td><p>Configures the depth test.</td>
</tr>
<tr>
<td><a href="#setDepthTest">setDepthTest</a></td><td><p>Enables or disables depth testing of fragments.</td>
</tr>
<tr>
<td><a href="#setDepthWrite">setDepthWrite</a></td><td><p>Enables or disables writes to the depth buffer.</td>
</tr>
<tr>
<td><a href="#setIndexBuffer">setIndexBuffer</a></td><td><p>Sets the current index buffer on the graphics device.</td>
</tr>
<tr>
<td><a href="#setRenderTarget">setRenderTarget</a></td><td><p>Sets the specified render target on the device.</td>
</tr>
<tr>
<td><a href="#setScissor">setScissor</a></td><td><p>Set the active scissor rectangle on the specified device.</td>
</tr>
<tr>
<td><a href="#setShader">setShader</a></td><td><p>Sets the active shader to be used during subsequent draw calls.</td>
</tr>
<tr>
<td><a href="#setStencilFunc">setStencilFunc</a></td><td><p>Configures stencil test for both front and back faces.</td>
</tr>
<tr>
<td><a href="#setStencilFuncBack">setStencilFuncBack</a></td><td><p>Configures stencil test for back faces.</td>
</tr>
<tr>
<td><a href="#setStencilFuncFront">setStencilFuncFront</a></td><td><p>Configures stencil test for front faces.</td>
</tr>
<tr>
<td><a href="#setStencilOperation">setStencilOperation</a></td><td><p>Configures how stencil buffer values should be modified based on the result
of depth/stencil tests.</td>
</tr>
<tr>
<td><a href="#setStencilOperationBack">setStencilOperationBack</a></td><td><p>Configures how stencil buffer values should be modified based on the result
of depth/stencil tests.</td>
</tr>
<tr>
<td><a href="#setStencilOperationFront">setStencilOperationFront</a></td><td><p>Configures how stencil buffer values should be modified based on the result
of depth/stencil tests.</td>
</tr>
<tr>
<td><a href="#setStencilTest">setStencilTest</a></td><td><p>Enables or disables stencil test.</td>
</tr>
<tr>
<td><a href="#setVertexBuffer">setVertexBuffer</a></td><td><p>Sets the current vertex buffer for a specific stream index on the graphics
device.</td>
</tr>
<tr>
<td><a href="#setViewport">setViewport</a></td><td><p>Set the active rectangle for rendering on the specified device.</td>
</tr>
<tr>
<td><a href="#updateBegin">updateBegin</a></td><td><p>Marks the beginning of a block of rendering.</td>
</tr>
<tr>
<td><a href="#updateEnd">updateEnd</a></td><td><p>Marks the end of a block of rendering.</td>
</tr>
</table>
<!--events-->
<h3>Events</h3>
<table class="properties">
<tr>
<td><a href="#event:resizecanvas">resizecanvas</a></td><td><p>The 'resizecanvas' event is fired when the canvas is resized.</td>
</tr>
</table>
<h2>Inherited</h2>
<!--inherited methods-->
<!--inherited properties-->
<!--inherited static methods-->
<h3>Methods</h3>
<table class="properties">
<tr>
<td><a href="#fire">fire</a></td><td><p>Fire an event, all additional arguments are passed on to the event listener.</td>
</tr>
<tr>
<td><a href="#hasEvent">hasEvent</a></td><td><p>Test if there are any handlers bound to an event name.</td>
</tr>
<tr>
<td><a href="#off">off</a></td><td><p>Detach an event handler from an event.</td>
</tr>
<tr>
<td><a href="#on">on</a></td><td><p>Attach an event handler to an event.</td>
</tr>
<tr>
<td><a href="#once">once</a></td><td><p>Attach an event handler to an event.</td>
</tr>
</table>
<!--inherited events-->
<h1>Details</h1>
<!--type definitions-->
<!--static members-->
<!--static methods-->
<h2>Constructor</h2>
<!-- Constructor -->
<div id="GraphicsDevice">
<h3 class="methodname">GraphicsDevice(canvas, [options]) <a class="font-icon" href="#GraphicsDevice"></a></h3>
<p><p>Creates a new graphics device.</p></p>
<h4>Parameters</h4>
<table>
<tr>
<td>canvas</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement">HTMLCanvasElement</a></td><td><p>The canvas to which the graphics device will render.</p></td>
</tr>
<tr>
<td>options</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></td><td><p>Options passed when creating the WebGL context. More info <a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement/getContext">here</a>.</p></td>
</tr>
</table>
</div>
<!--properties-->
<h2>Properties</h2>
<div id="canvas">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/API/HTMLCanvasElement">HTMLCanvasElement</a></span><span class="property">canvas <a class="font-icon" href="#canvas"></a></span>
<p><p>The canvas DOM element that provides the underlying WebGL context used by the graphics device.</p></p>
</div>
<div id="fullscreen">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span><span class="property">fullscreen <a class="font-icon" href="#fullscreen"></a></span>
<p><p>Fullscreen mode.</p></p>
</div>
<div id="height">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">height <a class="font-icon" href="#height"></a></span>
<p><p>Height of the back buffer in pixels.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="maxAnisotropy">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">maxAnisotropy <a class="font-icon" href="#maxAnisotropy"></a></span>
<p><p>The maximum supported texture anisotropy setting.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="maxCubeMapSize">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">maxCubeMapSize <a class="font-icon" href="#maxCubeMapSize"></a></span>
<p><p>The maximum supported dimension of a cube map.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="maxPixelRatio">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">maxPixelRatio <a class="font-icon" href="#maxPixelRatio"></a></span>
<p><p>Maximum pixel ratio.</p></p>
</div>
<div id="maxTextureSize">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">maxTextureSize <a class="font-icon" href="#maxTextureSize"></a></span>
<p><p>The maximum supported dimension of a texture.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="maxVolumeSize">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">maxVolumeSize <a class="font-icon" href="#maxVolumeSize"></a></span>
<p><p>The maximum supported dimension of a 3D texture (any axis).</p><span class='readonly'>[read only]</span></p>
</div>
<div id="precision">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String">string</a></span><span class="property">precision <a class="font-icon" href="#precision"></a></span>
<p><p>The highest shader precision supported by this graphics device. Can be 'hiphp', 'mediump' or 'lowp'.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="scope">
<span class="property"><a href="pc.ScopeSpace.html">pc.ScopeSpace</a></span><span class="property">scope <a class="font-icon" href="#scope"></a></span>
<p><p>The scope namespace for shader attributes and variables. [read only].</p></p>
</div>
<div id="supportsInstancing">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span><span class="property">supportsInstancing <a class="font-icon" href="#supportsInstancing"></a></span>
<p><p>True if hardware instancing is supported.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="textureFloatHighPrecision">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">textureFloatHighPrecision <a class="font-icon" href="#textureFloatHighPrecision"></a></span>
<p><p>Check if high precision floating-point textures are supported.</p><span class='readonly'>[read only]</span></p>
</div>
<div id="textureFloatRenderable">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span><span class="property">textureFloatRenderable <a class="font-icon" href="#textureFloatRenderable"></a></span>
<p><p>Determines if 32-bit floating-point textures can be used as frame buffer. [read only].</p></p>
</div>
<div id="textureHalfFloatRenderable">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></span><span class="property">textureHalfFloatRenderable <a class="font-icon" href="#textureHalfFloatRenderable"></a></span>
<p><p>Determines if 16-bit floating-point textures can be used as frame buffer. [read only].</p></p>
</div>
<div id="width">
<span class="property"><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></span><span class="property">width <a class="font-icon" href="#width"></a></span>
<p><p>Width of the back buffer in pixels.</p><span class='readonly'>[read only]</span></p>
</div>
<!--methods-->
<h2>Methods</h2>
<div id="clear">
<h3 class="methodname">clear(options) <a class="font-icon" href="#clear"></a></h3>
<p><p>Clears the frame buffer of the currently set render target.</p></p>
<pre><code class="javascript">// Clear color buffer to black and depth buffer to 1.0
device.clear();
// Clear just the color buffer to red
device.clear({
color: [1, 0, 0, 1],
flags: pc.CLEARFLAG_COLOR
});
// Clear color buffer to yellow and depth to 1.0
device.clear({
color: [1, 1, 0, 1],
depth: 1.0,
flags: pc.CLEARFLAG_COLOR | pc.CLEARFLAG_DEPTH
});</code></pre>
<h4>Parameters</h4>
<table>
<tr>
<td>options</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></td><td><p>Optional options object that controls the behavior of the clear operation defined as follows:</p></td>
</tr>
<tr>
<td>options.color</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number[]</a></td><td><p>The color to clear the color buffer to in the range 0.0 to 1.0 for each component.</p></td>
</tr>
<tr>
<td>options.depth</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The depth value to clear the depth buffer to in the range 0.0 to 1.0.</p></td>
</tr>
<tr>
<td>options.flags</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The buffers to clear (the types being color, depth and stencil). Can be any bitwise
combination of:</p>
<ul>
<li>pc.CLEARFLAG_COLOR</li>
<li>pc.CLEARFLAG_DEPTH</li>
<li>pc.CLEARFLAG_STENCIL</li>
</ul></td>
</tr>
</table>
</div>
<div id="clearShaderCache">
<h3 class="methodname">clearShaderCache() <a class="font-icon" href="#clearShaderCache"></a></h3>
<p><p>Frees memory from all shaders ever allocated with this device.</p></p>
</div>
<div id="draw">
<h3 class="methodname">draw(primitive, [numInstances]) <a class="font-icon" href="#draw"></a></h3>
<p><p>Submits a graphical primitive to the hardware for immediate rendering.</p></p>
<pre><code class="javascript">// Render a single, unindexed triangle
device.draw({
type: pc.PRIMITIVE_TRIANGLES,
base: 0,
count: 3,
indexed: false
});</code></pre>
<h4>Parameters</h4>
<table>
<tr>
<td>primitive</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object">object</a></td><td><p>Primitive object describing how to submit current vertex/index buffers defined as follows:</p></td>
</tr>
<tr>
<td>primitive.type</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The type of primitive to render. Can be:</p>
<ul>
<li><a href="pc.html#PRIMITIVE_POINTS">pc.PRIMITIVE_POINTS</a></li>
<li><a href="pc.html#PRIMITIVE_LINES">pc.PRIMITIVE_LINES</a></li>
<li><a href="pc.html#PRIMITIVE_LINELOOP">pc.PRIMITIVE_LINELOOP</a></li>
<li><a href="pc.html#PRIMITIVE_LINESTRIP">pc.PRIMITIVE_LINESTRIP</a></li>
<li><a href="pc.html#PRIMITIVE_TRIANGLES">pc.PRIMITIVE_TRIANGLES</a></li>
<li><a href="pc.html#PRIMITIVE_TRISTRIP">pc.PRIMITIVE_TRISTRIP</a></li>
<li><a href="pc.html#PRIMITIVE_TRIFAN">pc.PRIMITIVE_TRIFAN</a></li>
</ul></td>
</tr>
<tr>
<td>primitive.base</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The offset of the first index or vertex to dispatch in the draw call.</p></td>
</tr>
<tr>
<td>primitive.count</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The number of indices or vertices to dispatch in the draw call.</p></td>
</tr>
<tr>
<td>primitive.indexed</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></td><td><p>True to interpret the primitive as indexed, thereby using the currently set index buffer and false otherwise.</p></td>
</tr>
<tr>
<td>numInstances</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The number of instances to render when using ANGLE_instanced_arrays. Defaults to 1.</p></td>
</tr>
</table>
</div>
<div id="getBlending">
<h3 class="methodname">getBlending() <a class="font-icon" href="#getBlending"></a></h3>
<p><p>Queries whether blending is enabled.</p></p>
<h4>Returns</h4>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a> <p>True if blending is enabled and false otherwise.</p>
</div>
<div id="getDepthTest">
<h3 class="methodname">getDepthTest() <a class="font-icon" href="#getDepthTest"></a></h3>
<p><p>Queries whether depth testing is enabled.</p></p>
<pre><code class="javascript">var depthTest = device.getDepthTest();
console.log('Depth testing is ' + depthTest ? 'enabled' : 'disabled');</code></pre>
<h4>Returns</h4>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a> <p>True if depth testing is enabled and false otherwise.</p>
</div>
<div id="getDepthWrite">
<h3 class="methodname">getDepthWrite() <a class="font-icon" href="#getDepthWrite"></a></h3>
<p><p>Queries whether writes to the depth buffer are enabled.</p></p>
<pre><code class="javascript">var depthWrite = device.getDepthWrite();
console.log('Depth writing is ' + depthWrite ? 'enabled' : 'disabled');</code></pre>
<h4>Returns</h4>
<a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a> <p>True if depth writing is enabled and false otherwise.</p>
</div>
<div id="getRenderTarget">
<h3 class="methodname">getRenderTarget() <a class="font-icon" href="#getRenderTarget"></a></h3>
<p><p>Queries the currently set render target on the device.</p></p>
<pre><code class="javascript">// Get the current render target
var renderTarget = device.getRenderTarget();</code></pre>
<h4>Returns</h4>
<a href="pc.RenderTarget.html">pc.RenderTarget</a> <p>The current render target.</p>
</div>
<div id="resizeCanvas">
<h3 class="methodname">resizeCanvas(width, height) <a class="font-icon" href="#resizeCanvas"></a></h3>
<p><p>Sets the width and height of the canvas, then fires the 'resizecanvas' event.
Note that the specified width and height values will be multiplied by the value of
<a href="pc.GraphicsDevice.html#maxPixelRatio">pc.GraphicsDevice#maxPixelRatio</a> to give the final resultant width and height for
the canvas.</p></p>
<h4>Parameters</h4>
<table>
<tr>
<td>width</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The new width of the canvas.</p></td>
</tr>
<tr>
<td>height</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The new height of the canvas.</p></td>
</tr>
</table>
</div>
<div id="setBlendEquation">
<h3 class="methodname">setBlendEquation(blendEquation) <a class="font-icon" href="#setBlendEquation"></a></h3>
<p><p>Configures the blending equation. The default blend equation is
pc.BLENDEQUATION_ADD.</p></p>
<h4>Parameters</h4>
<table>
<tr>
<td>blendEquation</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The blend equation. Can be:</p>
<ul>
<li><a href="pc.html#BLENDEQUATION_ADD">pc.BLENDEQUATION_ADD</a></li>
<li><a href="pc.html#BLENDEQUATION_SUBTRACT">pc.BLENDEQUATION_SUBTRACT</a></li>
<li><a href="pc.html#BLENDEQUATION_REVERSE_SUBTRACT">pc.BLENDEQUATION_REVERSE_SUBTRACT</a></li>
<li><a href="pc.html#BLENDEQUATION_MIN">pc.BLENDEQUATION_MIN</a></li>
<li><a href="pc.html#BLENDEQUATION_MAX">pc.BLENDEQUATION_MAX</a></li>
</ul>
<p>Note that MIN and MAX modes require either EXT_blend_minmax or WebGL2 to work (check device.extBlendMinmax).</p></td>
</tr>
</table>
</div>
<div id="setBlendEquationSeparate">
<h3 class="methodname">setBlendEquationSeparate(blendEquation, blendAlphaEquation) <a class="font-icon" href="#setBlendEquationSeparate"></a></h3>
<p><p>Configures the blending equation. The default blend equation is
pc.BLENDEQUATION_ADD.</p></p>
<h4>Parameters</h4>
<table>
<tr>
<td>blendEquation</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The blend equation. Can be:</p>
<ul>
<li><a href="pc.html#BLENDEQUATION_ADD">pc.BLENDEQUATION_ADD</a></li>
<li><a href="pc.html#BLENDEQUATION_SUBTRACT">pc.BLENDEQUATION_SUBTRACT</a></li>
<li><a href="pc.html#BLENDEQUATION_REVERSE_SUBTRACT">pc.BLENDEQUATION_REVERSE_SUBTRACT</a></li>
<li><a href="pc.html#BLENDEQUATION_MIN">pc.BLENDEQUATION_MIN</a></li>
<li><a href="pc.html#BLENDEQUATION_MAX">pc.BLENDEQUATION_MAX</a></li>
</ul>
<p>Note that MIN and MAX modes require either EXT_blend_minmax or WebGL2 to work (check device.extBlendMinmax).</p></td>
</tr>
<tr>
<td>blendAlphaEquation</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>A separate blend equation for the alpha channel. Accepts same values as blendEquation.</p></td>
</tr>
</table>
</div>
<div id="setBlendFunction">
<h3 class="methodname">setBlendFunction(blendSrc, blendDst) <a class="font-icon" href="#setBlendFunction"></a></h3>
<p><p>Configures blending operations. Both source and destination
blend modes can take the following values:</p>
<ul>
<li><a href="pc.html#BLENDMODE_ZERO">pc.BLENDMODE_ZERO</a></li>
<li><a href="pc.html#BLENDMODE_ONE">pc.BLENDMODE_ONE</a></li>
<li><a href="pc.html#BLENDMODE_SRC_COLOR">pc.BLENDMODE_SRC_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_SRC_COLOR">pc.BLENDMODE_ONE_MINUS_SRC_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_DST_COLOR">pc.BLENDMODE_DST_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_DST_COLOR">pc.BLENDMODE_ONE_MINUS_DST_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_SRC_ALPHA">pc.BLENDMODE_SRC_ALPHA</a></li>
<li><a href="pc.html#BLENDMODE_SRC_ALPHA_SATURATE">pc.BLENDMODE_SRC_ALPHA_SATURATE</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_SRC_ALPHA">pc.BLENDMODE_ONE_MINUS_SRC_ALPHA</a></li>
<li><a href="pc.html#BLENDMODE_DST_ALPHA">pc.BLENDMODE_DST_ALPHA</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_DST_ALPHA">pc.BLENDMODE_ONE_MINUS_DST_ALPHA</a></li>
</ul></p>
<h4>Parameters</h4>
<table>
<tr>
<td>blendSrc</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The source blend function.</p></td>
</tr>
<tr>
<td>blendDst</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The destination blend function.</p></td>
</tr>
</table>
</div>
<div id="setBlendFunctionSeparate">
<h3 class="methodname">setBlendFunctionSeparate(blendSrc, blendDst, blendSrcAlpha, blendDstAlpha) <a class="font-icon" href="#setBlendFunctionSeparate"></a></h3>
<p><p>Configures blending operations. Both source and destination
blend modes can take the following values:</p>
<ul>
<li><a href="pc.html#BLENDMODE_ZERO">pc.BLENDMODE_ZERO</a></li>
<li><a href="pc.html#BLENDMODE_ONE">pc.BLENDMODE_ONE</a></li>
<li><a href="pc.html#BLENDMODE_SRC_COLOR">pc.BLENDMODE_SRC_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_SRC_COLOR">pc.BLENDMODE_ONE_MINUS_SRC_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_DST_COLOR">pc.BLENDMODE_DST_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_DST_COLOR">pc.BLENDMODE_ONE_MINUS_DST_COLOR</a></li>
<li><a href="pc.html#BLENDMODE_SRC_ALPHA">pc.BLENDMODE_SRC_ALPHA</a></li>
<li><a href="pc.html#BLENDMODE_SRC_ALPHA_SATURATE">pc.BLENDMODE_SRC_ALPHA_SATURATE</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_SRC_ALPHA">pc.BLENDMODE_ONE_MINUS_SRC_ALPHA</a></li>
<li><a href="pc.html#BLENDMODE_DST_ALPHA">pc.BLENDMODE_DST_ALPHA</a></li>
<li><a href="pc.html#BLENDMODE_ONE_MINUS_DST_ALPHA">pc.BLENDMODE_ONE_MINUS_DST_ALPHA</a></li>
</ul></p>
<h4>Parameters</h4>
<table>
<tr>
<td>blendSrc</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The source blend function.</p></td>
</tr>
<tr>
<td>blendDst</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The destination blend function.</p></td>
</tr>
<tr>
<td>blendSrcAlpha</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The separate source blend function for the alpha channel.</p></td>
</tr>
<tr>
<td>blendDstAlpha</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Number">number</a></td><td><p>The separate destination blend function for the alpha channel.</p></td>
</tr>
</table>
</div>
<div id="setBlending">
<h3 class="methodname">setBlending(blending) <a class="font-icon" href="#setBlending"></a></h3>
<p><p>Enables or disables blending.</p></p>
<h4>Parameters</h4>
<table>
<tr>
<td>blending</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></td><td><p>True to enable blending and false to disable it.</p></td>
</tr>
</table>
</div>
<div id="setColorWrite">
<h3 class="methodname">setColorWrite(writeRed, writeGreen, writeBlue, writeAlpha) <a class="font-icon" href="#setColorWrite"></a></h3>
<p><p>Enables or disables writes to the color buffer. Once this state
is set, it persists until it is changed. By default, color writes are enabled
for all color channels.</p></p>
<pre><code class="javascript">// Just write alpha into the frame buffer
device.setColorWrite(false, false, false, true);</code></pre>
<h4>Parameters</h4>
<table>
<tr>
<td>writeRed</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></td><td><p>True to enable writing of the red channel and false otherwise.</p></td>
</tr>
<tr>
<td>writeGreen</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></td><td><p>True to enable writing of the green channel and false otherwise.</p></td>
</tr>
<tr>
<td>writeBlue</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></td><td><p>True to enable writing of the blue channel and false otherwise.</p></td>
</tr>
<tr>
<td>writeAlpha</td><td><a href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Boolean">boolean</a></td><td><p>True to enable writing of the alpha channel and false otherwise.</p></td>
</tr>
</table>
</div>
<div id="setCullMode">
<h3 class="methodname">setCullMode(cullMode) <a class="font-icon" href="#setCullMode"></a></h3>
<p><p>Controls how triangles are culled based on their face direction.
The default cull mo