Context

new Cesium.Context()

Members

antialias : Boolean

true if the WebGL context supports antialiasing. By default antialiasing is requested, but it is not supported by all systems.

cache : Object

A cache of objects tied to this context. Just before the Context is destroyed, destroy will be invoked on each object in this object literal that has such a method. This is useful for caching any objects that might otherwise be stored globally, except they're tied to a particular context, and to manage their lifetime.

defaultCubeMap : CubeMap

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.

defaultFramebuffer : Object

Gets an object representing the currently bound framebuffer. While this instance is not an actual Framebuffer, it is used to represent the default framebuffer in calls to Texture.FromFramebuffer.

defaultTexture : Texture

A 1x1 RGBA texture initialized to [255, 255, 255, 255]. This can be used as a placeholder texture while other textures are downloaded.

depthTexture : Boolean

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.
See:

drawBuffers : Boolean

true if the WEBGL_draw_buffers extension is supported. This extensions provides support for multiple render targets. The framebuffer object can have mutiple color attachments and the GLSL fragment shader can write to the built-in output array gl_FragData. A shader using this feature needs to explicitly enable the extension with #extension GL_EXT_draw_buffers : enable.
See:

drawingBufferHeight : Number

The drawingBufferHeight of the underlying GL context.
See:

drawingBufferWidth : Number

The drawingBufferWidth of the underlying GL context.
See:

elementIndexUint : Boolean

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.
See:

etc1 : Boolean

true if WEBGL_texture_compression_etc1 is supported. This extension provides access to ETC1 compressed textures.
See:

floatingPointTexture : Boolean

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.
See:

fragmentDepth : Boolean

true if the EXT_frag_depth extension is supported. This extension provides access to the gl_FragDepthEXT built-in output variable from GLSL fragment shaders. A shader using these functions still needs to explicitly enable the extension with #extension GL_EXT_frag_depth : enable.
See:

instancedArrays : Boolean

true if the ANGLE_instanced_arrays extension is supported. This extension provides access to instanced rendering.
See:

memoryThreshold : Number

设置场景总的显存资源占用阈值,默认值:4G,单位GB。 根据机器内存显存大小适当调整这个值,避免因资源占满导致崩溃。

options

Example:
{
  webgl : {
    alpha : false,
    depth : true,
    stencil : false,
    antialias : true,
    premultipliedAlpha : true,
    preserveDrawingBuffer : false,
    failIfMajorPerformanceCaveat : true
  },
  allowTextureFilterAnisotropic : true
}

pvrtc : Boolean

true if WEBGL_texture_compression_pvrtc is supported. This extension provides access to PVR compressed textures.
See:

s3tc : Boolean

true if WEBGL_texture_compression_s3tc is supported. This extension provides access to DXT compressed textures.
See:

standardDerivatives : Boolean

true if the OES_standard_derivatives extension is supported. This extension provides access to dFdx, 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.
See:

stencilBits : Number

The number of stencil bits per pixel in the default bound framebuffer. The minimum is eight bits.
See:
  • glGet with STENCIL_BITS.

stencilBuffer : Boolean

true if the WebGL context supports stencil buffers. Stencil buffers are not supported by all systems.

vertexArrayObject : Boolean

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.
See:

Methods

createPickId(object)Object

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.
Name Type Description
object Object The object to associate with the pick ID.
Returns:
A PickId object with a color property.
Throws:
Example:
this._pickId = context.createPickId({
  primitive : this,
  id : this.id
});
See:

getObjectByPickColor(pickColor)Object

Gets the object associated with a pick color.
Name Type Description
pickColor Color The pick color.
Returns:
The object associated with the pick color, or undefined if no object is associated with that color.
Example:
var object = context.getObjectByPickColor(pickColor);
See: