WebGL2

WebGL2支持图形的绘制,包括对当前绘制图形的位置、颜色等进行处理,其中相对WebGL来说对渲染管道和着色语言进行了增强。

WebGL标准图形API,对应OpenGL ES 3.0特性集。更多信息请参考WebGL™标准

说明:

本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

WebGL2遵循OpenGL协议,不支持多线程调用。

目前该功能仅支持使用兼容JS的类Web开发范式开发。

调用方式

hml内创建canvas,示例如下:

<!--xxx.hml-->
<div class="container">
    <canvas ref="canvas1" style="width : 400px; height : 200px; background-color : lightyellow;"></canvas>
    <button class="btn-button" onclick="BtnDraw2D">BtnDraw2D</button>
</div>

js内获取canvas实例,示例如下:

// 获取canvas组件实例
const el = this.$refs.canvas1;
// 从canvas组件实例获取WebGL上下文
const gl = el.getContext('webgl2');
// 调用WebGL API
gl.clearColor(0.0, 0.0, 0.0, 1.0);

Type

系统能力: 以下各项对应的系统能力均为 SystemCapability.Graphic.Graphic2D.WebGL2。

表1 Type

名称 类型
GLenum number
GLint64 number
GLuint64 number
Uint32List array

Interface

系统能力: 以下各项对应的系统能力均为 SystemCapability.Graphic.Graphic2D.WebGL2。

表2 Interface

名称
WebGL2RenderingContextBase
WebGL2RenderingContextOverloads
WebGLQuery
WebGLSampler
WebGLSync
WebGLTransformFeedback
WebGLVertexArrayObject

WebGL2RenderingContextBase

WebGL2RenderingContextBase

属性

名称 参数类型 必填
READ_BUFFER GLenum
UNPACK_ROW_LENGTH GLenum
UNPACK_SKIP_ROWS GLenum
UNPACK_SKIP_PIXELS GLenum
PACK_ROW_LENGTH GLenum
PACK_SKIP_ROWS GLenum
PACK_SKIP_PIXELS GLenum
COLOR GLenum
DEPTH GLenum
STENCIL GLenum
RED GLenum
RGB8 GLenum
RGBA8 GLenum
RGB10_A2 GLenum
TEXTURE_BINDING_3D GLenum
UNPACK_SKIP_IMAGES GLenum
UNPACK_IMAGE_HEIGHT GLenum
TEXTURE_3D GLenum
TEXTURE_WRAP_R GLenum
MAX_3D_TEXTURE_SIZE GLenum
UNSIGNED_INT_2_10_10_10_REV GLenum
MAX_ELEMENTS_VERTICES GLenum
MAX_ELEMENTS_INDICES GLenum
TEXTURE_MIN_LOD GLenum
TEXTURE_MAX_LOD GLenum
TEXTURE_BASE_LEVEL GLenum
TEXTURE_MAX_LEVEL GLenum
MIN GLenum
MAX GLenum
DEPTH_COMPONENT24 GLenum
MAX_TEXTURE_LOD_BIAS GLenum
TEXTURE_COMPARE_MODE GLenum
TEXTURE_COMPARE_FUNC GLenum
CURRENT_QUERY GLenum
QUERY_RESULT GLenum
QUERY_RESULT_AVAILABLE GLenum
STREAM_READ GLenum
STREAM_COPY GLenum
STATIC_READ GLenum
STATIC_COPY GLenum
DYNAMIC_READ GLenum
DYNAMIC_COPY GLenum
MAX_DRAW_BUFFERS GLenum
DRAW_BUFFER0 GLenum
DRAW_BUFFER1 GLenum
DRAW_BUFFER2 GLenum
DRAW_BUFFER3 GLenum
DRAW_BUFFER4 GLenum
DRAW_BUFFER5 GLenum
DRAW_BUFFER6 GLenum
DRAW_BUFFER7 GLenum
DRAW_BUFFER8 GLenum
DRAW_BUFFER9 GLenum
DRAW_BUFFER10 GLenum
DRAW_BUFFER11 GLenum
DRAW_BUFFER12 GLenum
DRAW_BUFFER13 GLenum
DRAW_BUFFER14 GLenum
DRAW_BUFFER15 GLenum
MAX_FRAGMENT_UNIFORM_COMPONENTS GLenum
MAX_VERTEX_UNIFORM_COMPONENTS GLenum
SAMPLER_3D GLenum
SAMPLER_2D_SHADOW GLenum
FRAGMENT_SHADER_DERIVATIVE_HINT GLenum
PIXEL_PACK_BUFFER GLenum
PIXEL_UNPACK_BUFFER GLenum
PIXEL_PACK_BUFFER_BINDING GLenum
PIXEL_UNPACK_BUFFER_BINDING GLenum
FLOAT_MAT2x3 GLenum
FLOAT_MAT2x4 GLenum
FLOAT_MAT3x2 GLenum
FLOAT_MAT3x4 GLenum
FLOAT_MAT4x2 GLenum
FLOAT_MAT4x3 GLenum
SRGB GLenum
SRGB8 GLenum
SRGB8_ALPHA8 GLenum
COMPARE_REF_TO_TEXTURE GLenum
RGBA32F GLenum
RGB32F GLenum
RGBA16F GLenum
RGB16F GLenum
VERTEX_ATTRIB_ARRAY_INTEGER GLenum
MAX_ARRAY_TEXTURE_LAYERS GLenum
MIN_PROGRAM_TEXEL_OFFSET GLenum
MAX_PROGRAM_TEXEL_OFFSET GLenum
MAX_VARYING_COMPONENTS GLenum
TEXTURE_2D_ARRAY GLenum
TEXTURE_BINDING_2D_ARRAY GLenum
R11F_G11F_B10F GLenum
UNSIGNED_INT_10F_11F_11F_REV GLenum
RGB9_E5 GLenum
UNSIGNED_INT_5_9_9_9_REV GLenum
TRANSFORM_FEEDBACK_BUFFER_MODE GLenum
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS GLenum
TRANSFORM_FEEDBACK_VARYINGS GLenum
TRANSFORM_FEEDBACK_BUFFER_START GLenum
TRANSFORM_FEEDBACK_BUFFER_SIZE GLenum
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN GLenum
RASTERIZER_DISCARD GLenum
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS GLenum
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS GLenum
INTERLEAVED_ATTRIBS GLenum
SEPARATE_ATTRIBS GLenum
TRANSFORM_FEEDBACK_BUFFER GLenum
TRANSFORM_FEEDBACK_BUFFER_BINDING GLenum
RGBA32UI GLenum
RGB32UI GLenum
RGBA16UI GLenum
RGB16UI GLenum
RGBA8UI GLenum
RGB8UI GLenum
RGBA32I GLenum
RGB32I GLenum
RGBA16I GLenum
RGB16I GLenum
RGBA8I GLenum
RGB8I GLenum
RED_INTEGER GLenum
RGB_INTEGER GLenum
RGBA_INTEGER GLenum
SAMPLER_2D_ARRAY GLenum
SAMPLER_2D_ARRAY_SHADOW GLenum
SAMPLER_CUBE_SHADOW GLenum
UNSIGNED_INT_VEC2 GLenum
UNSIGNED_INT_VEC3 GLenum
UNSIGNED_INT_VEC4 GLenum
INT_SAMPLER_2D GLenum
INT_SAMPLER_3D GLenum
INT_SAMPLER_CUBE GLenum
INT_SAMPLER_2D_ARRAY GLenum
UNSIGNED_INT_SAMPLER_2D GLenum
UNSIGNED_INT_SAMPLER_3D GLenum
UNSIGNED_INT_SAMPLER_CUBE GLenum
UNSIGNED_INT_SAMPLER_2D_ARRAY GLenum
DEPTH_COMPONENT32F GLenum
DEPTH32F_STENCIL8 GLenum
FLOAT_32_UNSIGNED_INT_24_8_REV GLenum
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING GLenum
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE GLenum
FRAMEBUFFER_ATTACHMENT_RED_SIZE GLenum
FRAMEBUFFER_ATTACHMENT_GREEN_SIZE GLenum
FRAMEBUFFER_ATTACHMENT_BLUE_SIZE GLenum
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE GLenum
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE GLenum
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE GLenum
FRAMEBUFFER_DEFAULT GLenum
UNSIGNED_INT_24_8 GLenum
DEPTH24_STENCIL8 GLenum
UNSIGNED_NORMALIZED GLenum
DRAW_FRAMEBUFFER_BINDING GLenum
READ_FRAMEBUFFER GLenum
DRAW_FRAMEBUFFER GLenum
READ_FRAMEBUFFER_BINDING GLenum
RENDERBUFFER_SAMPLES GLenum
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER GLenum
MAX_COLOR_ATTACHMENTS GLenum
COLOR_ATTACHMENT1 GLenum
COLOR_ATTACHMENT2 GLenum
COLOR_ATTACHMENT3 GLenum
COLOR_ATTACHMENT4 GLenum
COLOR_ATTACHMENT5 GLenum
COLOR_ATTACHMENT6 GLenum
COLOR_ATTACHMENT7 GLenum
COLOR_ATTACHMENT8 GLenum
COLOR_ATTACHMENT9 GLenum
COLOR_ATTACHMENT10 GLenum
COLOR_ATTACHMENT11 GLenum
COLOR_ATTACHMENT12 GLenum
COLOR_ATTACHMENT13 GLenum
COLOR_ATTACHMENT14 GLenum
COLOR_ATTACHMENT15 GLenum
FRAMEBUFFER_INCOMPLETE_MULTISAMPLE GLenum
MAX_SAMPLES GLenum
HALF_FLOAT GLenum
RG GLenum
RG_INTEGER GLenum
R8 GLenum
RG8 GLenum
R16F GLenum
R32F GLenum
RG16F GLenum
RG32F GLenum
R8I GLenum
R8UI GLenum
R16I GLenum
R16UI GLenum
R32I GLenum
R32UI GLenum
RG8I GLenum
RG8UI GLenum
RG16I GLenum
RG16UI GLenum
RG32I GLenum
RG32UI GLenum
VERTEX_ARRAY_BINDING GLenum
R8_SNORM GLenum
RG8_SNORM GLenum
RGB8_SNORM GLenum
SIGNED_NORMALIZED GLenum
COPY_READ_BUFFER GLenum
COPY_WRITE_BUFFER GLenum
COPY_READ_BUFFER_BINDING GLenum
COPY_WRITE_BUFFER_BINDING GLenum
UNIFORM_BUFFER GLenum
UNIFORM_BUFFER_BINDING GLenum
UNIFORM_BUFFER_START GLenum
UNIFORM_BUFFER_SIZE GLenum
MAX_VERTEX_UNIFORM_BLOCKS GLenum
MAX_FRAGMENT_UNIFORM_BLOCKS GLenum
MAX_COMBINED_UNIFORM_BLOCKS GLenum
MAX_UNIFORM_BUFFER_BINDINGS GLenum
MAX_UNIFORM_BLOCK_SIZE GLenum
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS GLenum
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS GLenum
UNIFORM_BUFFER_OFFSET_ALIGNMENT GLenum
ACTIVE_UNIFORM_BLOCKS GLenum
UNIFORM_TYPE GLenum
UNIFORM_SIZE GLenum
UNIFORM_BLOCK_INDEX GLenum
UNIFORM_OFFSET GLenum
UNIFORM_ARRAY_STRIDE GLenum
UNIFORM_MATRIX_STRIDE GLenum
UNIFORM_IS_ROW_MAJOR GLenum
UNIFORM_BLOCK_BINDING GLenum
UNIFORM_BLOCK_DATA_SIZE GLenum
UNIFORM_BLOCK_ACTIVE_UNIFORMS GLenum
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES GLenum
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER GLenum
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER GLenum
INVALID_INDEX GLenum
MAX_VERTEX_OUTPUT_COMPONENTS GLenum
MAX_FRAGMENT_INPUT_COMPONENTS GLenum
MAX_SERVER_WAIT_TIMEOUT GLenum
OBJECT_TYPE GLenum
SYNC_CONDITION GLenum
SYNC_STATUS GLenum
SYNC_FLAGS GLenum
SYNC_FENCE GLenum
SYNC_GPU_COMMANDS_COMPLETE GLenum
UNSIGNALED GLenum
SIGNALED GLenum
ALREADY_SIGNALED GLenum
TIMEOUT_EXPIRED GLenum
CONDITION_SATISFIED GLenum
WAIT_FAILED GLenum
SYNC_FLUSH_COMMANDS_BIT GLenum
VERTEX_ATTRIB_ARRAY_DIVISOR GLenum
ANY_SAMPLES_PASSED GLenum
ANY_SAMPLES_PASSED_CONSERVATIVE GLenum
SAMPLER_BINDING GLenum
RGB10_A2UI GLenum
INT_2_10_10_10_REV GLenum
TRANSFORM_FEEDBACK GLenum
TRANSFORM_FEEDBACK_PAUSED GLenum
TRANSFORM_FEEDBACK_ACTIVE GLenum
TRANSFORM_FEEDBACK_BINDING GLenum
TEXTURE_IMMUTABLE_FORMAT GLenum
MAX_ELEMENT_INDEX GLenum
TEXTURE_IMMUTABLE_LEVELS GLenum
TIMEOUT_IGNORED GLint64
MAX_CLIENT_WAIT_TIMEOUT_WEBGL GLenum

方法

方法 返回值类型
copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr) void
getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint) void
blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum) void
framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture | null, level: GLint, layer: GLint) void
invalidateFramebuffer(target: GLenum, attachments: GLenum[]) void
invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei) void
readBuffer(src: GLenum) void
getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum) any
renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) void
texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) void
texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei) void
texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) void
texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) void
texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView | null) void
texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) void
texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) void
texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) void
texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView | null, srcOffset?: GLuint) void
copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) void
compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) void
compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) void
compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) void
compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) void
getFragDataLocation(program: WebGLProgram, name: string) GLint
uniform1ui(location: WebGLUniformLocation | null, v0: GLuint) void
uniform2ui(location: WebGLUniformLocation | null, v0: GLuint, v1: GLuint) void
uniform3ui(location: WebGLUniformLocation | null, v0: GLuint, v1: GLuint, v2: GLuint) void
uniform4ui(location: WebGLUniformLocation | null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint) void
uniform1uiv(location: WebGLUniformLocation | null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform2uiv(location: WebGLUniformLocation | null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform3uiv(location: WebGLUniformLocation | null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform4uiv(location: WebGLUniformLocation | null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix3x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix4x2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix2x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix4x3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix2x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix3x4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint) void
vertexAttribI4iv(index: GLuint, values: Int32List) void
vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) void
vertexAttribI4uiv(index: GLuint, values: Uint32List) void
vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr) void
vertexAttribDivisor(index: GLuint, divisor: GLuint) void
drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) void
drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) void
drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr) void
drawBuffers(buffers: GLenum[]) void
clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint) void
clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint) void
clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint) void
clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint) void
createQuery() WebGLQuery | null
deleteQuery(query: WebGLQuery | null) void
isQuery(query: WebGLQuery | null) GLboolean
beginQuery(target: GLenum, query: WebGLQuery) void
endQuery(target: GLenum) void
getQuery(target: GLenum, pname: GLenum) WebGLQuery | null
getQueryParameter(query: WebGLQuery, pname: GLenum) any
createSampler() WebGLSampler | null
deleteSampler(sampler: WebGLSampler | null) void
isSampler(sampler: WebGLSampler | null) GLboolean
bindSampler(unit: GLuint, sampler: WebGLSampler | null) void
samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint) void
samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat) void;
getSamplerParameter(sampler: WebGLSampler, pname: GLenum) any
fenceSync(condition: GLenum, flags: GLbitfield) WebGLSync | null
isSync(sync: WebGLSync | null) GLboolean
deleteSync(sync: WebGLSync | null) void
clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64) GLenum
waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64) void
getSyncParameter(sync: WebGLSync, pname: GLenum) any
createTransformFeedback() WebGLTransformFeedback | null
deleteTransformFeedback(tf: WebGLTransformFeedback | null) void
isTransformFeedback(tf: WebGLTransformFeedback | null) GLboolean
bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback | null) void
beginTransformFeedback(primitiveMode: GLenum) void
endTransformFeedback() void
transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum) void
getTransformFeedbackVarying(program: WebGLProgram, index: GLuint) WebGLActiveInfo | null
pauseTransformFeedback() void
resumeTransformFeedback() void
bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer | null) void
bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer | null, offset: GLintptr, size: GLsizeiptr) void
getIndexedParameter(target: GLenum, index: GLuint) any
getUniformIndices(program: WebGLProgram, uniformNames: string[]) GLuint[] | null
getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum) any
getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string) GLuint
getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum) any
getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint) string | null
uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint) void
createVertexArray() WebGLVertexArrayObject | null
deleteVertexArray(vertexArray: WebGLVertexArrayObject | null) void
isVertexArray(vertexArray: WebGLVertexArrayObject | null) GLboolean
bindVertexArray(array: WebGLVertexArrayObject | null) void

WebGL2RenderingContextOverloads

WebGL2RenderingContextOverloads

方法 返回值类型
bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) void
bufferData(target: GLenum, srcData: BufferSource | null, usage: GLenum) void
bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: BufferSource) void
bufferData(target: GLenum, srcData: ArrayBufferView, usage: GLenum, srcOffset: GLuint, length?: GLuint) void
bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: ArrayBufferView, srcOffset: GLuint, length?: GLuint) void
texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView | null) void
texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) void
texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView | null) void
texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) void
texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) void
texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) void
texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) void
texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) void
texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) void
texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) void
compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) void
compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) void
compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) void
compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) void
uniform1fv(location: WebGLUniformLocation | null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform2fv(location: WebGLUniformLocation | null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform3fv(location: WebGLUniformLocation | null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform4fv(location: WebGLUniformLocation | null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform1iv(location: WebGLUniformLocation | null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform2iv(location: WebGLUniformLocation | null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform3iv(location: WebGLUniformLocation | null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniform4iv(location: WebGLUniformLocation | null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix2fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix3fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
uniformMatrix4fv(location: WebGLUniformLocation | null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) void
readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView | null) void
readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, offset: GLintptr) void
readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView, dstOffset: GLuint) void