Skip to content

RenderingContext

JS
    RenderingContext

画布对象的绘图上下文

必须通过下列其中之一获取:

  • 通过 Canvas.getContext('2d') 接口可以获取 CanvasRenderingContext2D 对象
  • 通过 Canvas.getContext('webgl')Canvas.getContext('experimental-webgl') 接口可以获取到 WebGLRenderingContext 对象
  • 通过 Canvas.getContext('webgl2')Canvas.getContext('experimental-webgl2') 接口可以获取到 WebGL2RenderingContext 对象

2d 接口支持情况:

支持 HTMl Canvas2D Context 定义的大部分属性、方法

WebGL 接口支持情况:

支持 WebGL 1.0WebGL 2.0 定义的属性、方法、常量。支持的扩展,具体见下表

支持的扩展

  • ANGLE_instanced_arrays
  • EXT_blend_minmax
  • EXT_color_buffer_half_float
  • EXT_color_buffer_float
  • EXT_float_blend
  • EXT_sRGB
  • EXT_texture_filter_anisotropic
  • OES_element_index_uint
  • OES_fbo_render_mipmap
  • OES_texture_float
  • OES_texture_float_linear
  • OES_texture_half_float
  • OES_texture_half_float_linear
  • OES_vertex_array_object
  • WEBGL_compressed_texture_astc
  • WEBGL_compressed_texture_etc1
  • WEBGL_compressed_texture_etc
  • WEBGL_compressed_texture_pvrtc
  • WEBGL_compressed_texture_s3tc
  • WEBGL_compressed_texture_s3tc_srgb
  • WEBGL_color_buffer_float
  • WEBGL_depth_texture