new Context
DOC_TBA
Throws:
-
RuntimeError : The browser does not support WebGL. Visit http://get.webgl.org.
-
RuntimeError : The browser supports WebGL, but initialization failed.
-
DeveloperError : canvas is required.
Source:
Methods
-
beginDraw
-
DOC_TBA
-
clear
-
Executes the specified clear command.
Parameters:
Name Type Argument Description clearCommand
ClearCommand <optional>
The command with which to clear. passState
PassState <optional>
The state for the current rendering pass. See:
-
continueDraw
-
DOC_TBA
-
createCubeMap
-
DOC_TBA. description.source can be {ImageData}, {HTMLImageElement}, {HTMLCanvasElement}, or {HTMLVideoElement}.
Throws:
-
RuntimeError : When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.
-
DeveloperError : description is required.
-
DeveloperError : description.source requires positiveX, negativeX, positiveY, negativeY, positiveZ, and negativeZ faces.
-
DeveloperError : Each face in description.sources must have the same width and height.
-
DeveloperError : description requires a source field to create an initialized cube map or width and height fields to create a blank cube map.
-
DeveloperError : Width must equal height.
-
DeveloperError : Width and height must be greater than zero.
-
DeveloperError : Width and height must be less than or equal to the maximum cube map size.
-
DeveloperError : Invalid description.pixelFormat.
-
DeveloperError : description.pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.
-
DeveloperError : Invalid description.pixelDatatype.
Returns:
CubeMap DOC_TBA. -
-
createFramebuffer
-
Creates a framebuffer with optional initial color, depth, and stencil attachments. Framebuffers are used for render-to-texture effects; they allow us to render to a texture in one pass, and read from it in a later pass.
Parameters:
Name Type Argument Description description
Object <optional>
The initial framebuffer attachments as shown in Example 2. The possible properties are colorTexture
,colorRenderbuffer
,depthTexture
,depthRenderbuffer
,stencilRenderbuffer
,depthStencilTexture
, anddepthStencilRenderbuffer
.Throws:
-
DeveloperError : Cannot have both a color texture and color renderbuffer attachment.
-
DeveloperError : Cannot have both a depth texture and depth renderbuffer attachment.
-
DeveloperError : Cannot have both a depth-stencil texture and depth-stencil renderbuffer attachment.
-
DeveloperError : Cannot have both a depth and depth-stencil renderbuffer.
-
DeveloperError : Cannot have both a stencil and depth-stencil renderbuffer.
-
DeveloperError : Cannot have both a depth and stencil renderbuffer.
-
DeveloperError : The color-texture pixel-format must be a color format.
-
DeveloperError : The depth-texture pixel-format must be DEPTH_COMPONENT.
-
DeveloperError : The depth-stencil-texture pixel-format must be DEPTH_STENCIL.
Returns:
Framebuffer The created framebuffer.Example
// Example 1. Create a framebuffer with no initial attachments, // and then add a color-texture attachment. var framebuffer = context.createFramebuffer(); framebuffer.setColorTexture(context.createTexture2D({ width : 256, height : 256, })); ////////////////////////////////////////////////////////////////// // Example 2. Create a framebuffer with color and depth texture attachments. var width = context.getCanvas().clientWidth; var height = context.getCanvas().clientHeight; var framebuffer = context.createFramebuffer({ colorTexture : context.createTexture2D({ width : width, height : height, pixelFormat : PixelFormat.RGBA }), depthTexture : context.createTexture2D({ width : width, height : height, pixelFormat : PixelFormat.DEPTH_COMPONENT, pixelDatatype : PixelDatatype.UNSIGNED_SHORT }) });
-
-
createIndexBuffer
-
Creates an index buffer, which contains typed indices in GPU-controlled memory.
An index buffer can be attached to a vertex array to select vertices for rendering.Context.draw
can render using the entire index buffer or a subset of the index buffer defined by an offset and count.Parameters:
Name Type Description typedArrayOrSizeInBytes
ArrayBufferView | Number A typed array containing the data to copy to the buffer, or a Number
defining the size of the buffer in bytes.usage
BufferUsage Specifies the expected usage pattern of the buffer. On some GL implementations, this can significantly affect performance. See BufferUsage. indexDatatype
IndexDatatype The datatype of indices in the buffer. Throws:
-
RuntimeError : IndexDatatype.UNSIGNED_INT requires OES_element_index_uint, which is not supported on this system.
-
DeveloperError : The size in bytes must be greater than zero.
-
DeveloperError : Invalid
usage
. -
DeveloperError : Invalid
indexDatatype
.
Returns:
IndexBuffer The index buffer, ready to be attached to a vertex array.Example
// Example 1. Create a stream index buffer of unsigned shorts that is // 16 bytes in size. var buffer = context.createIndexBuffer(16, BufferUsage.STREAM_DRAW, IndexDatatype.UNSIGNED_SHORT); //////////////////////////////////////////////////////////////////////////////// // Example 2. Create a static index buffer containing three unsigned shorts. var buffer = context.createIndexBuffer(new Uint16Array([0, 1, 2]), BufferUsage.STATIC_DRAW, IndexDatatype.UNSIGNED_SHORT)
- Context#createVertexArray
- Context#createVertexBuffer
- Context#draw
- VertexArray
- glGenBuffer
- glBindBuffer with
ELEMENT_ARRAY_BUFFER
- glBufferData with
ELEMENT_ARRAY_BUFFER
See:
-
-
createPickFramebuffer
-
DOC_TBA
- Context#pick
See:
-
createPickId
-
Creates a unique ID associated with the input object for use with color-buffer picking. The ID has an RGBA color value unique to this context. You must call destroy() on the pick ID when destroying the input object.
Parameters:
Name Type Description object
Object The object to associate with the pick ID. Throws:
-
DeveloperError : object is required.
-
RuntimeError : Out of unique Pick IDs.
Returns:
Object A PickId object with acolor
property.Example
this._pickId = context.createPickId(this);
-
-
createRenderbuffer
-
DOC_TBA.
Parameters:
Name Type Argument Description description
Object <optional>
DOC_TBA. Throws:
-
DeveloperError : Invalid format.
-
DeveloperError : Width must be greater than zero.
-
DeveloperError : Width must be less than or equal to the maximum renderbuffer size.
-
DeveloperError : Height must be greater than zero.
-
DeveloperError : Height must be less than or equal to the maximum renderbuffer size.
Returns:
createRenderbuffer DOC_TBA. -
-
createRenderState
-
Validates and then finds or creates an immutable render state, which defines the pipeline state for a DrawCommand or ClearCommand. All inputs states are optional. Omitted states use the defaults shown in the example below.
Parameters:
Name Type Argument Default Description renderState
Object <optional>
undefined The states defining the render state as shown in the example below. Throws:
-
RuntimeError : renderState.lineWidth is out of range.
-
DeveloperError : Invalid renderState.frontFace.
-
DeveloperError : Invalid renderState.cull.face.
-
DeveloperError : scissorTest.rectangle.width and scissorTest.rectangle.height must be greater than or equal to zero.
-
DeveloperError : renderState.depthRange.near can't be greater than renderState.depthRange.far.
-
DeveloperError : renderState.depthRange.near must be greater than or equal to zero.
-
DeveloperError : renderState.depthRange.far must be less than or equal to zero.
-
DeveloperError : Invalid renderState.depthTest.func.
-
DeveloperError : renderState.blending.color components must be greater than or equal to zero and less than or equal to one
-
DeveloperError : Invalid renderState.blending.equationRgb.
-
DeveloperError : Invalid renderState.blending.equationAlpha.
-
DeveloperError : Invalid renderState.blending.functionSourceRgb.
-
DeveloperError : Invalid renderState.blending.functionSourceAlpha.
-
DeveloperError : Invalid renderState.blending.functionDestinationRgb.
-
DeveloperError : Invalid renderState.blending.functionDestinationAlpha.
-
DeveloperError : Invalid renderState.stencilTest.frontFunction.
-
DeveloperError : Invalid renderState.stencilTest.backFunction.
-
DeveloperError : Invalid renderState.stencilTest.frontOperation.fail.
-
DeveloperError : Invalid renderState.stencilTest.frontOperation.zFail.
-
DeveloperError : Invalid renderState.stencilTest.frontOperation.zPass.
-
DeveloperError : Invalid renderState.stencilTest.backOperation.fail.
-
DeveloperError : Invalid renderState.stencilTest.backOperation.zFail.
-
DeveloperError : Invalid renderState.stencilTest.backOperation.zPass.
-
DeveloperError : renderState.viewport.width must be greater than or equal to zero.
-
DeveloperError : renderState.viewport.width must be less than or equal to the maximum viewport width.
-
DeveloperError : renderState.viewport.height must be greater than or equal to zero.
-
DeveloperError : renderState.viewport.height must be less than or equal to the maximum viewport height.
Example
var defaults = { frontFace : WindingOrder.COUNTER_CLOCKWISE, cull : { enabled : false, face : CullFace.BACK }, lineWidth : 1, polygonOffset : { enabled : false, factor : 0, units : 0 }, scissorTest : { enabled : false, rectangle : { x : 0, y : 0, width : 0, height : 0 } }, depthRange : { near : 0, far : 1 }, depthTest : { enabled : false, func : DepthFunction.LESS }, colorMask : { red : true, green : true, blue : true, alpha : true }, depthMask : true, stencilMask : ~0, blending : { enabled : false, color : { red : 0.0, green : 0.0, blue : 0.0, alpha : 0.0 }, equationRgb : BlendEquation.ADD, equationAlpha : BlendEquation.ADD, functionSourceRgb : BlendFunction.ONE, functionSourceAlpha : BlendFunction.ONE, functionDestinationRgb : BlendFunction.ZERO, functionDestinationAlpha : BlendFunction.ZERO }, stencilTest : { enabled : false, frontFunction : StencilFunction.ALWAYS, backFunction : StencilFunction.ALWAYS, reference : 0, mask : ~0, frontOperation : { fail : StencilOperation.KEEP, zFail : StencilOperation.KEEP, zPass : StencilOperation.KEEP }, backOperation : { fail : StencilOperation.KEEP, zFail : StencilOperation.KEEP, zPass : StencilOperation.KEEP } }, sampleCoverage : { enabled : false, value : 1.0, invert : false }, dither : true }; // Same as just context.createRenderState(). var rs = context.createRenderState(defaults);
See:
-
-
createSampler
-
DOC_TBA
Throws:
-
DeveloperError : Invalid sampler.wrapS.
-
DeveloperError : Invalid sampler.wrapT.
-
DeveloperError : Invalid sampler.minificationFilter.
-
DeveloperError : Invalid sampler.magnificationFilter.
-
-
createShaderProgram
-
Creates a shader program given the GLSL source for a vertex and fragment shader.
The vertex and fragment shader are individually compiled, and then linked together to create a shader program. An exception is thrown if any errors are encountered, as described below.
The program's active uniforms and attributes are queried and can be accessed using the returned shader program. The caller can explicitly define the vertex attribute indices using the optionalattributeLocations
argument as shown in example two below.Parameters:
Name Type Argument Default Description vertexShaderSource
String The GLSL source for the vertex shader. fragmentShaderSource
String The GLSL source for the fragment shader. attributeLocations
Object <optional>
undefined An optional object that maps vertex attribute names to indices for use with vertex arrays. Throws:
-
RuntimeError : Vertex shader failed to compile.
-
RuntimeError : Fragment shader failed to compile.
-
RuntimeError : Program failed to link.
Returns:
ShaderProgram The compiled and linked shader program, ready for use in a draw call.Example
// Example 1. Create a shader program allowing the GL to determine // attribute indices. var vs = 'attribute vec4 position; void main() { gl_Position = position; }'; var fs = 'void main() { gl_FragColor = vec4(1.0); }'; var sp = context.createShaderProgram(vs, fs); //////////////////////////////////////////////////////////////////////////////// // Example 2. Create a shader program with explicit attribute indices. var vs = 'attribute vec4 position;' + 'attribute vec3 normal;' + 'void main() { ... }'; var fs = 'void main() { gl_FragColor = vec4(1.0); }'; var attributes = { position : 0, normal : 1 }; sp = context.createShaderProgram(vs, fs, attributes); *
-
-
createTexture2D
-
DOC_TBA. description.source can be {ImageData}, {HTMLImageElement}, {HTMLCanvasElement}, or {HTMLVideoElement}.
Throws:
-
RuntimeError : When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, this WebGL implementation must support WEBGL_depth_texture.
-
RuntimeError : When description.pixelDatatype is FLOAT, this WebGL implementation must support the OES_texture_float extension.
-
DeveloperError : description is required.
-
DeveloperError : description requires a source field to create an initialized texture or width and height fields to create a blank texture.
-
DeveloperError : Width must be greater than zero.
-
DeveloperError : Width must be less than or equal to the maximum texture size.
-
DeveloperError : Height must be greater than zero.
-
DeveloperError : Height must be less than or equal to the maximum texture size.
-
DeveloperError : Invalid description.pixelFormat.
-
DeveloperError : Invalid description.pixelDatatype.
-
DeveloperError : When description.pixelFormat is DEPTH_COMPONENT, description.pixelDatatype must be UNSIGNED_SHORT or UNSIGNED_INT.
-
DeveloperError : When description.pixelFormat is DEPTH_STENCIL, description.pixelDatatype must be UNSIGNED_INT_24_8_WEBGL.
-
DeveloperError : When description.pixelFormat is DEPTH_COMPONENT or DEPTH_STENCIL, source cannot be provided.
Returns:
Texture DOC_TBA. -
-
createTexture2DFromFramebuffer
-
Creates a texture, and copies a subimage of the framebuffer to it. When called without arguments, the texture is the same width and height as the framebuffer and contains its contents.
Parameters:
Name Type Argument Default Description pixelFormat
PixelFormat <optional>
PixelFormat.RGB The texture's internal pixel format. framebufferXOffset
PixelFormat <optional>
0 An offset in the x direction in the framebuffer where copying begins from. framebufferYOffset
PixelFormat <optional>
0 An offset in the y direction in the framebuffer where copying begins from. width
PixelFormat <optional>
canvas.clientWidth The width of the texture in texels. height
PixelFormat <optional>
canvas.clientHeight The height of the texture in texels. Throws:
-
DeveloperError : Invalid pixelFormat.
-
DeveloperError : pixelFormat cannot be DEPTH_COMPONENT or DEPTH_STENCIL.
-
DeveloperError : framebufferXOffset must be greater than or equal to zero.
-
DeveloperError : framebufferYOffset must be greater than or equal to zero.
-
DeveloperError : framebufferXOffset + width must be less than or equal to getCanvas().clientWidth.
-
DeveloperError : framebufferYOffset + height must be less than or equal to getCanvas().clientHeight.
Returns:
Texture A texture with contents from the framebuffer.Example
// Create a texture with the contents of the framebuffer. var t = context.createTexture2DFromFramebuffer();
-
-
createTextureAtlas
-
Creates a new texture atlas with this context.
Parameters:
Name Type Argument Default Description description.pixelFormat
PixelFormat <optional>
PixelFormat.RGBA The pixel format of the texture. description.borderWidthInPixels
Number <optional>
1 The amount of spacing between adjacent images in pixels. description.initialSize
Cartesian2 <optional>
new Cartesian2(16.0, 16.0) The initial side lengths of the texture. description.images
Array <optional>
undefined Array of Image to be added to the atlas. Same as calling addImages(images). description.image
Image <optional>
undefined Single image to be added to the atlas. Same as calling addImage(image). Returns:
TextureAtlas The new texture atlas.See:
-
createVertexArray
-
Creates a vertex array, which defines the attributes making up a vertex, and contains an optional index buffer to select vertices for rendering. Attributes are defined using object literals as shown in Example 1 below.
Parameters:
Name Type Argument Default Description attributes
Array <optional>
undefined An optional array of attributes. indexBuffer
IndexBuffer <optional>
undefined An optional index buffer. Throws:
-
DeveloperError : Attribute must have a
vertexBuffer
. -
DeveloperError : Attribute must have a
componentsPerAttribute
. -
DeveloperError : Attribute must have a valid
componentDatatype
or not specify it. -
DeveloperError : Attribute must have a
strideInBytes
less than or equal to 255 or not specify it. -
DeveloperError : Index n is used by more than one attribute.
Returns:
VertexArray The vertex array, ready for use with drawing.Example
// Example 1. Create a vertex array with vertices made up of three floating point // values, e.g., a position, from a single vertex buffer. No index buffer is used. var positionBuffer = context.createVertexBuffer(12, BufferUsage.STATIC_DRAW); var attributes = [ { index : 0, enabled : true, vertexBuffer : positionBuffer, componentsPerAttribute : 3, componentDatatype : ComponentDatatype.FLOAT, normalize : false, offsetInBytes : 0, strideInBytes : 0 // tightly packed } ]; var va = context.createVertexArray(attributes); //////////////////////////////////////////////////////////////////////////////// // Example 2. Create a vertex array with vertices from two different vertex buffers. // Each vertex has a three-component position and three-component normal. var positionBuffer = context.createVertexBuffer(12, BufferUsage.STATIC_DRAW); var normalBuffer = context.createVertexBuffer(12, BufferUsage.STATIC_DRAW); var attributes = [ { index : 0, vertexBuffer : positionBuffer, componentsPerAttribute : 3, componentDatatype : ComponentDatatype.FLOAT }, { index : 1, vertexBuffer : normalBuffer, componentsPerAttribute : 3, componentDatatype : ComponentDatatype.FLOAT } ]; var va = context.createVertexArray(attributes); //////////////////////////////////////////////////////////////////////////////// // Example 3. Creates the same vertex layout as Example 2 using a single // vertex buffer, instead of two. var buffer = context.createVertexBuffer(24, BufferUsage.STATIC_DRAW); var attributes = [ { vertexBuffer : buffer, componentsPerAttribute : 3, componentDatatype : ComponentDatatype.FLOAT, offsetInBytes : 0, strideInBytes : 24 }, { vertexBuffer : buffer, componentsPerAttribute : 3, componentDatatype : ComponentDatatype.FLOAT, normalize : true, offsetInBytes : 12, strideInBytes : 24 } ]; var va = context.createVertexArray(attributes);
-
-
createVertexArrayFromGeometry
-
Creates a vertex array from a geometry. A geometry contains vertex attributes and optional index data in system memory, whereas a vertex array contains vertex buffers and an optional index buffer in WebGL memory for use with rendering.
Thegeometry
argument should use the standard layout like the geometry returned by BoxGeometry.
creationArguments
can have four properties:geometry
: The source geometry containing data used to create the vertex array.attributeIndices
: An object that maps geometry attribute names to vertex shader attribute indices.bufferUsage
: The expected usage pattern of the vertex array's buffers. On some WebGL implementations, this can significantly affect performance. See BufferUsage. Default:BufferUsage.DYNAMIC_DRAW
.vertexLayout
: Determines if all attributes are interleaved in a single vertex buffer or if each attribute is stored in a separate vertex buffer. Default:VertexLayout.SEPARATE
.
IfcreationArguments
is not specified or thegeometry
contains no data, the returned vertex array is empty.Parameters:
Name Type Argument Default Description creationArguments
Object <optional>
undefined An object defining the geometry, attribute indices, buffer usage, and vertex layout used to create the vertex array. Throws:
-
RuntimeError : Each attribute list must have the same number of vertices.
-
DeveloperError : The geometry must have zero or one index lists.
-
DeveloperError : Index n is used by more than one attribute.
Example
// Example 1. Creates a vertex array for rendering a box. The default dynamic draw // usage is used for the created vertex and index buffer. The attributes are not // interleaved by default. var geometry = new BoxGeometry(); var va = context.createVertexArrayFromGeometry({ geometry : geometry, attributeIndices : GeometryPipeline.createAttributeIndices(geometry), }); //////////////////////////////////////////////////////////////////////////////// // Example 2. Creates a vertex array with interleaved attributes in a // single vertex buffer. The vertex and index buffer have static draw usage. var va = context.createVertexArrayFromGeometry({ geometry : geometry, attributeIndices : GeometryPipeline.createAttributeIndices(geometry), bufferUsage : BufferUsage.STATIC_DRAW, vertexLayout : VertexLayout.INTERLEAVED }); //////////////////////////////////////////////////////////////////////////////// // Example 3. When the caller destroys the vertex array, it also destroys the // attached vertex buffer(s) and index buffer. va = va.destroy();
-
createVertexBuffer
-
Creates a vertex buffer, which contains untyped vertex data in GPU-controlled memory.
A vertex array defines the actual makeup of a vertex, e.g., positions, normals, texture coordinates, etc., by interpreting the raw data in one or more vertex buffers.Parameters:
Name Type Description typedArrayOrSizeInBytes
ArrayBufferView | Number A typed array containing the data to copy to the buffer, or a Number
defining the size of the buffer in bytes.usage
BufferUsage Specifies the expected usage pattern of the buffer. On some GL implementations, this can significantly affect performance. See BufferUsage. Throws:
-
DeveloperError : The size in bytes must be greater than zero.
-
DeveloperError : Invalid
usage
.
Returns:
VertexBuffer The vertex buffer, ready to be attached to a vertex array.Example
// Example 1. Create a dynamic vertex buffer 16 bytes in size. var buffer = context.createVertexBuffer(16, BufferUsage.DYNAMIC_DRAW); //////////////////////////////////////////////////////////////////////////////// // Example 2. Create a dynamic vertex buffer from three floating-point values. // The data copied to the vertex buffer is considered raw bytes until it is // interpreted as vertices using a vertex array. var positionBuffer = context.createVertexBuffer(new Float32Array([0, 0, 0]), BufferUsage.STATIC_DRAW);
- Context#createVertexArray
- Context#createIndexBuffer
- glGenBuffer
- glBindBuffer with
ARRAY_BUFFER
- glBufferData with
ARRAY_BUFFER
See:
-
-
draw
-
Executes the specified draw command.
Parameters:
Name Type Argument Description drawCommand
DrawCommand The command with which to draw. passState
PassState <optional>
The state for the current rendering pass Throws:
-
DeveloperError : drawCommand is required.
-
DeveloperError : drawCommand.primitiveType is required and must be valid.
-
DeveloperError : drawCommand.shaderProgram is required.
-
DeveloperError : drawCommand.vertexArray is required.
-
DeveloperError : drawCommand.offset must be omitted or greater than or equal to zero.
-
DeveloperError : Program validation failed.
-
DeveloperError : Framebuffer is not complete.
Example
// Example 1. Draw a single triangle specifying only required arguments context.draw({ primitiveType : PrimitiveType.TRIANGLES, shaderProgram : sp, vertexArray : va, }); //////////////////////////////////////////////////////////////////////////////// // Example 2. Draw a single triangle specifying every argument context.draw({ primitiveType : PrimitiveType.TRIANGLES, offset : 0, count : 3, framebuffer : fb, shaderProgram : sp, vertexArray : va, renderState : rs });
-
-
endDraw
-
DOC_TBA
-
getAlphaBits
-
Returns the number of alpha bits per component in the default framebuffer's color buffer. The minimum is eight.
The alpha channel is used for GL destination alpha operations and by the HTML compositor to combine the color buffer with the rest of the page.Returns:
Number The number of alpha bits per component in the color buffer.- glGet with
ALPHA_BITS
.
See:
- glGet with
-
getAntialias
-
Returns
true
if the WebGL context supports antialiasing. By default antialiasing is requested, but it is not supported by all systems.Returns:
Booleantrue
if antialiasing is supported. -
getBlueBits
-
Returns the number of blue bits per component in the default framebuffer's color buffer. The minimum is eight.
Returns:
Number The number of blue bits per component in the color buffer.- glGet with
BLUE_BITS
.
See:
- glGet with
-
getCanvas
-
Returns the canvas assoicated with this context.
Returns:
HTMLCanvasElement The canvas assoicated with this context. -
getDefaultCubeMap
-
Returns a cube map, where each face is a 1x1 RGBA texture initialized to [255, 255, 255, 255]. This can be used as a placeholder cube map while other cube maps are downloaded.
Returns:
-
getDefaultTexture
-
Returns a 1x1 RGBA texture initialized to [255, 255, 255, 255]. This can be used as a placeholder texture while other textures are downloaded.
Returns:
-
getDepthBits
-
Returns the number of depth bits per pixel in the default bound framebuffer. The minimum is 16 bits; most implementations will have 24 bits.
Returns:
Number The number of depth bits per pixel in the default bound framebuffer.- glGet with
DEPTH_BITS
.
See:
- glGet with
-
getDepthTexture
-
Returns
true
if WEBGL_depth_texture is supported. This extension provides access to depth textures that, for example, can be attached to framebuffers for shadow mapping.Returns:
Booleantrue
if WEBGL_depth_texture is supported; otherwise,false
.See:
-
getElementIndexUint
-
Returns
true
if the OES_element_index_uint extension is supported. This extension allows the use of unsigned int indices, which can improve performance by eliminating batch breaking caused by unsigned short indices.Returns:
Booleantrue
if OES_element_index_uint is supported; otherwise,false
. -
getFloatingPointTexture
-
Returns
true
if OES_texture_float is supported. This extension provides access to floating point textures that, for example, can be attached to framebuffers for high dynamic range.Returns:
Booleantrue
if OES_texture_float is supported; otherwise,false
.See:
-
getGreenBits
-
Returns the number of green bits per component in the default framebuffer's color buffer. The minimum is eight.
Returns:
Number The number of green bits per component in the color buffer.- glGet with
GREEN_BITS
.
See:
- glGet with
-
getId
-
Returns a unique ID for this context.
Returns:
String A unique ID for this context. -
getLogShaderCompilation
-
DOC_TBA
-
getMaximumAliasedLineWidth
-
Returns the maximum aliased line width, in pixels, supported by this WebGL implementation. It will be at least one.
Returns:
Number The maximum aliased line in pixels.- Context#getMinimumAliasedLineWidth
- glGet with
ALIASED_LINE_WIDTH_RANGE
.
See:
-
getMaximumAliasedPointSize
-
Returns the maximum aliased point size, in pixels, supported by this WebGL implementation. It will be at least one.
Returns:
Number The maximum aliased point size in pixels.- Context#getMinimumAliasedPointSize
- glGet with
ALIASED_POINT_SIZE_RANGE
.
See:
-
getMaximumCombinedTextureImageUnits
-
Returns the maximum number of texture units that can be used from the vertex and fragment shader with this WebGL implementation. The minimum is eight. If both shaders access the same texture unit, this counts as two texture units.
Returns:
Number The maximum supported texture image units.- Context#getMaximumTextureImageUnits
- Context#getMaximumVertexTextureImageUnits
- glGet with
MAX_COMBINED_TEXTURE_IMAGE_UNITS
.
See:
-
getMaximumCubeMapSize
-
Returns the approximate maximum cube mape width and height supported by this WebGL implementation. The minimum is 16, but most desktop and laptop implementations will support much larger sizes like 8,192.
Returns:
Number The approximate maximum cube mape width and height.- Context#createCubeMap
- Context#getMaximumTextureSize
- glGet with
MAX_CUBE_MAP_TEXTURE_SIZE
.
See:
-
getMaximumFragmentUniformVectors
-
Returns the maximum number of
vec4
,ivec4
, andbvec4
uniforms that can be used by a fragment shader with this WebGL implementation. The minimum is 16.Returns:
Number The maximum number ofvec4
,ivec4
, andbvec4
uniforms that can be used by a fragment shader.- Context#getMaximumVertexUniformVectors
- glGet with
MAX_FRAGMENT_UNIFORM_VECTORS
.
See:
-
getMaximumRenderbufferSize
-
Returns the maximum renderbuffer width and height supported by this WebGL implementation. The minimum is 16, but most desktop and laptop implementations will support much larger sizes like 8,192.
Returns:
Number The maximum renderbuffer width and height.- Context#createRenderbuffer
- glGet with
MAX_RENDERBUFFER_SIZE
.
See:
-
getMaximumTextureFilterAnisotropy
-
DOC_TBA
-
getMaximumTextureImageUnits
-
Returns the maximum number of texture units that can be used from the fragment shader with this WebGL implementation. The minimum is eight.
Returns:
Number The maximum number of texture units that can be used from the fragment shader.- Context#getMaximumCombinedTextureImageUnits
- Context#getMaximumVertexTextureImageUnits
- glGet with
MAX_TEXTURE_IMAGE_UNITS
.
See:
-
getMaximumTextureSize
-
Returns the approximate maximum texture width and height supported by this WebGL implementation. The minimum is 64, but most desktop and laptop implementations will support much larger sizes like 8,192.
Returns:
Number The approximate maximum texture width and height.- Context#createTexture2D
- Context#getMaximumCubeMapSize
- glGet with
MAX_TEXTURE_SIZE
.
See:
-
getMaximumVaryingVectors
-
Returns the maximum number of
vec4
varying variables supported by this WebGL implementation. The minimum is eight. Matrices and arrays count as multiplevec4
s.Returns:
Number Returns the maximum number ofvec4
varying variables.- glGet with
MAX_VARYING_VECTORS
.
See:
- glGet with
-
getMaximumVertexAttributes
-
Returns the maximum number of
vec4
vertex attributes supported by this WebGL implementation. The minimum is eight.Returns:
Number The maximum number ofvec4
vertex attributes.- Context#createVertexArray
- glGet with
MAX_VERTEX_ATTRIBS
.
See:
-
getMaximumVertexTextureImageUnits
-
Returns the maximum number of texture units that can be used from the vertex shader with this WebGL implementation. The minimum is zero, which means the GL does not support vertex texture fetch.
Returns:
Number The maximum number of texture units that can be used from the vertex shader.- Context#getMaximumCombinedTextureImageUnits
- Context#getMaximumTextureImageUnits
- glGet with
MAX_VERTEX_TEXTURE_IMAGE_UNITS
.
See:
-
getMaximumVertexUniformVectors
-
Returns the maximum number of
vec4
,ivec4
, andbvec4
uniforms that can be used by a vertex shader with this WebGL implementation. The minimum is 16.Returns:
Number The maximum number ofvec4
,ivec4
, andbvec4
uniforms that can be used by a vertex shader.- Context#getMaximumFragmentUniformVectors
- glGet with
MAX_VERTEX_UNIFORM_VECTORS
.
See:
-
getMaximumViewportHeight
-
Returns the maximum supported height of the viewport. It will be at least as large as the visible height of the associated canvas.
Returns:
Number The maximum supported height of the viewport.- Context#getMaximumViewportHeight
- glGet with
MAX_VIEWPORT_DIMS
.
See:
-
getMaximumViewportWidth
-
Returns the maximum supported width of the viewport. It will be at least as large as the visible width of the associated canvas.
Returns:
Number The maximum supported width of the viewport.- Context#getMaximumViewportHeight
- glGet with
MAX_VIEWPORT_DIMS
.
See:
-
getMinimumAliasedLineWidth
-
Returns the minimum aliased line width, in pixels, supported by this WebGL implementation. It will be at most one.
Returns:
Number The minimum aliased line in pixels.- Context#getMaximumAliasedLineWidth
- glGet with
ALIASED_LINE_WIDTH_RANGE
.
See:
-
getMinimumAliasedPointSize
-
Returns the minimum aliased point size, in pixels, supported by this WebGL implementation. It will be at most one.
Returns:
Number The minimum aliased point size in pixels.- Context#getMaximumAliasedPointSize
- glGet with
ALIASED_POINT_SIZE_RANGE
.
See:
-
getObjectByPickColor
-
Gets the object associated with a pick color.
Parameters:
Name Type Description The
Color pick color. Throws:
DeveloperError : pickColor is required.Returns:
Object The object associated with the pick color, or undefined if no object is associated with that color.Example
var object = context.getObjectByPickColor(pickColor);
See:
-
getRedBits
-
Returns the number of red bits per component in the default framebuffer's color buffer. The minimum is eight.
Returns:
Number The number of red bits per component in the color buffer.- glGet with
RED_BITS
.
See:
- glGet with
-
getRenderer
-
Returns the name of the renderer/configuration/hardware platform. For example, this may be the model of the video card, e.g., 'GeForce 8800 GTS/PCI/SSE2', or the browser-dependent name of the GL implementation, e.g. 'Mozilla' or 'ANGLE.'
Returns:
String The name of the renderer.- glGetString with
RENDERER
. - ANGLE
See:
- glGetString with
-
getShaderCache
-
DOC_TBA
-
getShadingLanguageVersion
-
Returns the version or release number for the shading language of the form WebGL<space>GLSL<space>ES<space><version number><space><vendor-specific information>.
Returns:
String The version or release number for the shading language.- glGetString with
SHADING_LANGUAGE_VERSION
.
See:
- glGetString with
-
getStandardDerivatives
-
Returns
true
if the OES_standard_derivatives extension is supported. This extension provides access todFdx
,
dFdy
, and
fwidth
functions from GLSL. A shader using these functions still needs to explicitly enable the extension with
#extension GL_OES_standard_derivatives : enable
.Returns:
Booleantrue
if OES_standard_derivatives is supported; otherwise,false
. -
getStencilBits
-
Returns the number of stencil bits per pixel in the default bound framebuffer. The minimum is eight bits.
Returns:
Number The number of stencil bits per pixel in the default bound framebuffer.- glGet with
STENCIL_BITS
.
See:
- glGet with
-
getTextureFilterAnisotropic
-
DOC_TBA
Returns:
Booleantrue
if EXT_texture_filter_anisotropic is supported; otherwise,false
. -
getThrowOnWebGLError
-
DOC_TBA
-
getUniformState
-
DOC_TBA
-
getValidateFramebuffer
-
DOC_TBA
-
getValidateShaderProgram
-
DOC_TBA
-
getVendor
-
Returns the company responsible for the WebGL implementation.
Returns:
String The company responsible for the WebGL implementation.- glGetString with
VENDOR
.
See:
- glGetString with
-
getVersion
-
Returns the WebGL version or release number of the form <WebGL><space><version number><space><vendor-specific information>.
Returns:
String The WebGL version or release number.- glGetString with
VERSION
.
See:
- glGetString with
-
getVertexArrayObject
-
Returns
true
if the OES_vertex_array_object extension is supported. This extension can improve performance by reducing the overhead of switching vertex arrays. When enabled, this extension is automatically used by VertexArray.Returns:
Booleantrue
if OES_vertex_array_object is supported; otherwise,false
. -
readPixels
-
DOC_TBA
Throws:
-
DeveloperError : readState.width must be greater than zero.
-
DeveloperError : readState.height must be greater than zero.
-
-
setLogShaderCompilation
-
DOC_TBA
-
setThrowOnWebGLError
-
DOC_TBA
Performance:
DOC_TBA: slow.
-
setValidateFramebuffer
-
DOC_TBA
Performance:
DOC_TBA: slow.
-
setValidateShaderProgram
-
DOC_TBA
Performance:
DOC_TBA: slow.