1# WebGL2 2 3WebGL2支持图形的绘制,包括对当前绘制图形的位置、颜色等进行处理,其中相对WebGL来说对渲染管道和着色语言进行了增强。 4 5WebGL标准图形API,对应OpenGL ES 3.0特性集。更多信息请参考[WebGL™标准](https://www.khronos.org/registry/webgl/specs/latest/2.0/)。 6 7> **说明:** 8> 9> 本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。 10> 11> WebGL2遵循OpenGL协议,不支持多线程调用。 12> 13> 目前该功能仅支持使用兼容JS的类Web开发范式开发。 14 15 16## 调用方式 17 18hml内创建canvas,示例如下: 19 20 21```html 22<!--xxx.hml--> 23<div class="container"> 24 <canvas ref="canvas1" style="width : 400px; height : 200px; background-color : lightyellow;"></canvas> 25 <button class="btn-button" onclick="BtnDraw2D">BtnDraw2D</button> 26</div> 27``` 28 29js内获取canvas实例,示例如下: 30 31 32```js 33// 获取canvas组件实例 34const el = this.$refs.canvas1; 35// 从canvas组件实例获取WebGL上下文 36const gl = el.getContext('webgl2'); 37// 调用WebGL API 38gl.clearColor(0.0, 0.0, 0.0, 1.0); 39``` 40 41 42## Type 43 44**系统能力:** 以下各项对应的系统能力均为 SystemCapability.Graphic.Graphic2D.WebGL2。 45 46 **表1** Type 47 48| 名称 | 类型 | 49| -------- | -------- | 50| GLenum | number | 51| GLint64 | number | 52| GLuint64 | number | 53| Uint32List | array | 54 55 56## Interface 57 58**系统能力:** 以下各项对应的系统能力均为 SystemCapability.Graphic.Graphic2D.WebGL2。 59 60 **表2** Interface 61 62| 名称 | 63| -------- | 64| [WebGL2RenderingContextBase](#webgl2renderingcontextbase) | 65| [WebGL2RenderingContextOverloads](#webgl2renderingcontextoverloads) | 66| WebGLQuery | 67| WebGLSampler | 68| WebGLSync | 69| WebGLTransformFeedback | 70| WebGLVertexArrayObject | 71 72 73## WebGL2RenderingContextBase 74 75WebGL2RenderingContextBase 76 77 78### 属性 79 80 | 名称 | 参数类型 | 必填 | 81| -------- | -------- | -------- | 82| READ_BUFFER | GLenum | 是 | 83| UNPACK_ROW_LENGTH | GLenum | 是 | 84| UNPACK_SKIP_ROWS | GLenum | 是 | 85| UNPACK_SKIP_PIXELS | GLenum | 是 | 86| PACK_ROW_LENGTH | GLenum | 是 | 87| PACK_SKIP_ROWS | GLenum | 是 | 88| PACK_SKIP_PIXELS | GLenum | 是 | 89| COLOR | GLenum | 是 | 90| DEPTH | GLenum | 是 | 91| STENCIL | GLenum | 是 | 92| RED | GLenum | 是 | 93| RGB8 | GLenum | 是 | 94| RGBA8 | GLenum | 是 | 95| RGB10_A2 | GLenum | 是 | 96| TEXTURE_BINDING_3D | GLenum | 是 | 97| UNPACK_SKIP_IMAGES | GLenum | 是 | 98| UNPACK_IMAGE_HEIGHT | GLenum | 是 | 99| TEXTURE_3D | GLenum | 是 | 100| TEXTURE_WRAP_R | GLenum | 是 | 101| MAX_3D_TEXTURE_SIZE | GLenum | 是 | 102| UNSIGNED_INT_2_10_10_10_REV | GLenum | 是 | 103| MAX_ELEMENTS_VERTICES | GLenum | 是 | 104| MAX_ELEMENTS_INDICES | GLenum | 是 | 105| TEXTURE_MIN_LOD | GLenum | 是 | 106| TEXTURE_MAX_LOD | GLenum | 是 | 107| TEXTURE_BASE_LEVEL | GLenum | 是 | 108| TEXTURE_MAX_LEVEL | GLenum | 是 | 109| MIN | GLenum | 是 | 110| MAX | GLenum | 是 | 111| DEPTH_COMPONENT24 | GLenum | 是 | 112| MAX_TEXTURE_LOD_BIAS | GLenum | 是 | 113| TEXTURE_COMPARE_MODE | GLenum | 是 | 114| TEXTURE_COMPARE_FUNC | GLenum | 是 | 115| CURRENT_QUERY | GLenum | 是 | 116| QUERY_RESULT | GLenum | 是 | 117| QUERY_RESULT_AVAILABLE | GLenum | 是 | 118| STREAM_READ | GLenum | 是 | 119| STREAM_COPY | GLenum | 是 | 120| STATIC_READ | GLenum | 是 | 121| STATIC_COPY | GLenum | 是 | 122| DYNAMIC_READ | GLenum | 是 | 123| DYNAMIC_COPY | GLenum | 是 | 124| MAX_DRAW_BUFFERS | GLenum | 是 | 125| DRAW_BUFFER0 | GLenum | 是 | 126| DRAW_BUFFER1 | GLenum | 是 | 127| DRAW_BUFFER2 | GLenum | 是 | 128| DRAW_BUFFER3 | GLenum | 是 | 129| DRAW_BUFFER4 | GLenum | 是 | 130| DRAW_BUFFER5 | GLenum | 是 | 131| DRAW_BUFFER6 | GLenum | 是 | 132| DRAW_BUFFER7 | GLenum | 是 | 133| DRAW_BUFFER8 | GLenum | 是 | 134| DRAW_BUFFER9 | GLenum | 是 | 135| DRAW_BUFFER10 | GLenum | 是 | 136| DRAW_BUFFER11 | GLenum | 是 | 137| DRAW_BUFFER12 | GLenum | 是 | 138| DRAW_BUFFER13 | GLenum | 是 | 139| DRAW_BUFFER14 | GLenum | 是 | 140| DRAW_BUFFER15 | GLenum | 是 | 141| MAX_FRAGMENT_UNIFORM_COMPONENTS | GLenum | 是 | 142| MAX_VERTEX_UNIFORM_COMPONENTS | GLenum | 是 | 143| SAMPLER_3D | GLenum | 是 | 144| SAMPLER_2D_SHADOW | GLenum | 是 | 145| FRAGMENT_SHADER_DERIVATIVE_HINT | GLenum | 是 | 146| PIXEL_PACK_BUFFER | GLenum | 是 | 147| PIXEL_UNPACK_BUFFER | GLenum | 是 | 148| PIXEL_PACK_BUFFER_BINDING | GLenum | 是 | 149| PIXEL_UNPACK_BUFFER_BINDING | GLenum | 是 | 150| FLOAT_MAT2x3 | GLenum | 是 | 151| FLOAT_MAT2x4 | GLenum | 是 | 152| FLOAT_MAT3x2 | GLenum | 是 | 153| FLOAT_MAT3x4 | GLenum | 是 | 154| FLOAT_MAT4x2 | GLenum | 是 | 155| FLOAT_MAT4x3 | GLenum | 是 | 156| SRGB | GLenum | 是 | 157| SRGB8 | GLenum | 是 | 158| SRGB8_ALPHA8 | GLenum | 是 | 159| COMPARE_REF_TO_TEXTURE | GLenum | 是 | 160| RGBA32F | GLenum | 是 | 161| RGB32F | GLenum | 是 | 162| RGBA16F | GLenum | 是 | 163| RGB16F | GLenum | 是 | 164| VERTEX_ATTRIB_ARRAY_INTEGER | GLenum | 是 | 165| MAX_ARRAY_TEXTURE_LAYERS | GLenum | 是 | 166| MIN_PROGRAM_TEXEL_OFFSET | GLenum | 是 | 167| MAX_PROGRAM_TEXEL_OFFSET | GLenum | 是 | 168| MAX_VARYING_COMPONENTS | GLenum | 是 | 169| TEXTURE_2D_ARRAY | GLenum | 是 | 170| TEXTURE_BINDING_2D_ARRAY | GLenum | 是 | 171| R11F_G11F_B10F | GLenum | 是 | 172| UNSIGNED_INT_10F_11F_11F_REV | GLenum | 是 | 173| RGB9_E5 | GLenum | 是 | 174| UNSIGNED_INT_5_9_9_9_REV | GLenum | 是 | 175| TRANSFORM_FEEDBACK_BUFFER_MODE | GLenum | 是 | 176| MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS | GLenum | 是 | 177| TRANSFORM_FEEDBACK_VARYINGS | GLenum | 是 | 178| TRANSFORM_FEEDBACK_BUFFER_START | GLenum | 是 | 179| TRANSFORM_FEEDBACK_BUFFER_SIZE | GLenum | 是 | 180| TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN | GLenum | 是 | 181| RASTERIZER_DISCARD | GLenum | 是 | 182| MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS | GLenum | 是 | 183| MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS | GLenum | 是 | 184| INTERLEAVED_ATTRIBS | GLenum | 是 | 185| SEPARATE_ATTRIBS | GLenum | 是 | 186| TRANSFORM_FEEDBACK_BUFFER | GLenum | 是 | 187| TRANSFORM_FEEDBACK_BUFFER_BINDING | GLenum | 是 | 188| RGBA32UI | GLenum | 是 | 189| RGB32UI | GLenum | 是 | 190| RGBA16UI | GLenum | 是 | 191| RGB16UI | GLenum | 是 | 192| RGBA8UI | GLenum | 是 | 193| RGB8UI | GLenum | 是 | 194| RGBA32I | GLenum | 是 | 195| RGB32I | GLenum | 是 | 196| RGBA16I | GLenum | 是 | 197| RGB16I | GLenum | 是 | 198| RGBA8I | GLenum | 是 | 199| RGB8I | GLenum | 是 | 200| RED_INTEGER | GLenum | 是 | 201| RGB_INTEGER | GLenum | 是 | 202| RGBA_INTEGER | GLenum | 是 | 203| SAMPLER_2D_ARRAY | GLenum | 是 | 204| SAMPLER_2D_ARRAY_SHADOW | GLenum | 是 | 205| SAMPLER_CUBE_SHADOW | GLenum | 是 | 206| UNSIGNED_INT_VEC2 | GLenum | 是 | 207| UNSIGNED_INT_VEC3 | GLenum | 是 | 208| UNSIGNED_INT_VEC4 | GLenum | 是 | 209| INT_SAMPLER_2D | GLenum | 是 | 210| INT_SAMPLER_3D | GLenum | 是 | 211| INT_SAMPLER_CUBE | GLenum | 是 | 212| INT_SAMPLER_2D_ARRAY | GLenum | 是 | 213| UNSIGNED_INT_SAMPLER_2D | GLenum | 是 | 214| UNSIGNED_INT_SAMPLER_3D | GLenum | 是 | 215| UNSIGNED_INT_SAMPLER_CUBE | GLenum | 是 | 216| UNSIGNED_INT_SAMPLER_2D_ARRAY | GLenum | 是 | 217| DEPTH_COMPONENT32F | GLenum | 是 | 218| DEPTH32F_STENCIL8 | GLenum | 是 | 219| FLOAT_32_UNSIGNED_INT_24_8_REV | GLenum | 是 | 220| FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING | GLenum | 是 | 221| FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE | GLenum | 是 | 222| FRAMEBUFFER_ATTACHMENT_RED_SIZE | GLenum | 是 | 223| FRAMEBUFFER_ATTACHMENT_GREEN_SIZE | GLenum | 是 | 224| FRAMEBUFFER_ATTACHMENT_BLUE_SIZE | GLenum | 是 | 225| FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE | GLenum | 是 | 226| FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE | GLenum | 是 | 227| FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE | GLenum | 是 | 228| FRAMEBUFFER_DEFAULT | GLenum | 是 | 229| UNSIGNED_INT_24_8 | GLenum | 是 | 230| DEPTH24_STENCIL8 | GLenum | 是 | 231| UNSIGNED_NORMALIZED | GLenum | 是 | 232| DRAW_FRAMEBUFFER_BINDING | GLenum | 是 | 233| READ_FRAMEBUFFER | GLenum | 是 | 234| DRAW_FRAMEBUFFER | GLenum | 是 | 235| READ_FRAMEBUFFER_BINDING | GLenum | 是 | 236| RENDERBUFFER_SAMPLES | GLenum | 是 | 237| FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER | GLenum | 是 | 238| MAX_COLOR_ATTACHMENTS | GLenum | 是 | 239| COLOR_ATTACHMENT1 | GLenum | 是 | 240| COLOR_ATTACHMENT2 | GLenum | 是 | 241| COLOR_ATTACHMENT3 | GLenum | 是 | 242| COLOR_ATTACHMENT4 | GLenum | 是 | 243| COLOR_ATTACHMENT5 | GLenum | 是 | 244| COLOR_ATTACHMENT6 | GLenum | 是 | 245| COLOR_ATTACHMENT7 | GLenum | 是 | 246| COLOR_ATTACHMENT8 | GLenum | 是 | 247| COLOR_ATTACHMENT9 | GLenum | 是 | 248| COLOR_ATTACHMENT10 | GLenum | 是 | 249| COLOR_ATTACHMENT11 | GLenum | 是 | 250| COLOR_ATTACHMENT12 | GLenum | 是 | 251| COLOR_ATTACHMENT13 | GLenum | 是 | 252| COLOR_ATTACHMENT14 | GLenum | 是 | 253| COLOR_ATTACHMENT15 | GLenum | 是 | 254| FRAMEBUFFER_INCOMPLETE_MULTISAMPLE | GLenum | 是 | 255| MAX_SAMPLES | GLenum | 是 | 256| HALF_FLOAT | GLenum | 是 | 257| RG | GLenum | 是 | 258| RG_INTEGER | GLenum | 是 | 259| R8 | GLenum | 是 | 260| RG8 | GLenum | 是 | 261| R16F | GLenum | 是 | 262| R32F | GLenum | 是 | 263| RG16F | GLenum | 是 | 264| RG32F | GLenum | 是 | 265| R8I | GLenum | 是 | 266| R8UI | GLenum | 是 | 267| R16I | GLenum | 是 | 268| R16UI | GLenum | 是 | 269| R32I | GLenum | 是 | 270| R32UI | GLenum | 是 | 271| RG8I | GLenum | 是 | 272| RG8UI | GLenum | 是 | 273| RG16I | GLenum | 是 | 274| RG16UI | GLenum | 是 | 275| RG32I | GLenum | 是 | 276| RG32UI | GLenum | 是 | 277| VERTEX_ARRAY_BINDING | GLenum | 是 | 278| R8_SNORM | GLenum | 是 | 279| RG8_SNORM | GLenum | 是 | 280| RGB8_SNORM | GLenum | 是 | 281| SIGNED_NORMALIZED | GLenum | 是 | 282| COPY_READ_BUFFER | GLenum | 是 | 283| COPY_WRITE_BUFFER | GLenum | 是 | 284| COPY_READ_BUFFER_BINDING | GLenum | 是 | 285| COPY_WRITE_BUFFER_BINDING | GLenum | 是 | 286| UNIFORM_BUFFER | GLenum | 是 | 287| UNIFORM_BUFFER_BINDING | GLenum | 是 | 288| UNIFORM_BUFFER_START | GLenum | 是 | 289| UNIFORM_BUFFER_SIZE | GLenum | 是 | 290| MAX_VERTEX_UNIFORM_BLOCKS | GLenum | 是 | 291| MAX_FRAGMENT_UNIFORM_BLOCKS | GLenum | 是 | 292| MAX_COMBINED_UNIFORM_BLOCKS | GLenum | 是 | 293| MAX_UNIFORM_BUFFER_BINDINGS | GLenum | 是 | 294| MAX_UNIFORM_BLOCK_SIZE | GLenum | 是 | 295| MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS | GLenum | 是 | 296| MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS | GLenum | 是 | 297| UNIFORM_BUFFER_OFFSET_ALIGNMENT | GLenum | 是 | 298| ACTIVE_UNIFORM_BLOCKS | GLenum | 是 | 299| UNIFORM_TYPE | GLenum | 是 | 300| UNIFORM_SIZE | GLenum | 是 | 301| UNIFORM_BLOCK_INDEX | GLenum | 是 | 302| UNIFORM_OFFSET | GLenum | 是 | 303| UNIFORM_ARRAY_STRIDE | GLenum | 是 | 304| UNIFORM_MATRIX_STRIDE | GLenum | 是 | 305| UNIFORM_IS_ROW_MAJOR | GLenum | 是 | 306| UNIFORM_BLOCK_BINDING | GLenum | 是 | 307| UNIFORM_BLOCK_DATA_SIZE | GLenum | 是 | 308| UNIFORM_BLOCK_ACTIVE_UNIFORMS | GLenum | 是 | 309| UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES | GLenum | 是 | 310| UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER | GLenum | 是 | 311| UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER | GLenum | 是 | 312| INVALID_INDEX | GLenum | 是 | 313| MAX_VERTEX_OUTPUT_COMPONENTS | GLenum | 是 | 314| MAX_FRAGMENT_INPUT_COMPONENTS | GLenum | 是 | 315| MAX_SERVER_WAIT_TIMEOUT | GLenum | 是 | 316| OBJECT_TYPE | GLenum | 是 | 317| SYNC_CONDITION | GLenum | 是 | 318| SYNC_STATUS | GLenum | 是 | 319| SYNC_FLAGS | GLenum | 是 | 320| SYNC_FENCE | GLenum | 是 | 321| SYNC_GPU_COMMANDS_COMPLETE | GLenum | 是 | 322| UNSIGNALED | GLenum | 是 | 323| SIGNALED | GLenum | 是 | 324| ALREADY_SIGNALED | GLenum | 是 | 325| TIMEOUT_EXPIRED | GLenum | 是 | 326| CONDITION_SATISFIED | GLenum | 是 | 327| WAIT_FAILED | GLenum | 是 | 328| SYNC_FLUSH_COMMANDS_BIT | GLenum | 是 | 329| VERTEX_ATTRIB_ARRAY_DIVISOR | GLenum | 是 | 330| ANY_SAMPLES_PASSED | GLenum | 是 | 331| ANY_SAMPLES_PASSED_CONSERVATIVE | GLenum | 是 | 332| SAMPLER_BINDING | GLenum | 是 | 333| RGB10_A2UI | GLenum | 是 | 334| INT_2_10_10_10_REV | GLenum | 是 | 335| TRANSFORM_FEEDBACK | GLenum | 是 | 336| TRANSFORM_FEEDBACK_PAUSED | GLenum | 是 | 337| TRANSFORM_FEEDBACK_ACTIVE | GLenum | 是 | 338| TRANSFORM_FEEDBACK_BINDING | GLenum | 是 | 339| TEXTURE_IMMUTABLE_FORMAT | GLenum | 是 | 340| MAX_ELEMENT_INDEX | GLenum | 是 | 341| TEXTURE_IMMUTABLE_LEVELS | GLenum | 是 | 342| TIMEOUT_IGNORED | GLint64 | 是 | 343| MAX_CLIENT_WAIT_TIMEOUT_WEBGL | GLenum | 是 | 344 345 346### 方法 347 348 | 方法 | 返回值类型 | 349| -------- | -------- | 350| copyBufferSubData(readTarget: GLenum, writeTarget: GLenum, readOffset: GLintptr, writeOffset: GLintptr, size: GLsizeiptr) | void | 351| getBufferSubData(target: GLenum, srcByteOffset: GLintptr, dstBuffer: ArrayBufferView, dstOffset?: GLuint, length?: GLuint) | void | 352| blitFramebuffer(srcX0: GLint, srcY0: GLint, srcX1: GLint, srcY1: GLint, dstX0: GLint, dstY0: GLint, dstX1: GLint, dstY1: GLint, mask: GLbitfield, filter: GLenum) | void | 353| framebufferTextureLayer(target: GLenum, attachment: GLenum, texture: WebGLTexture \| null, level: GLint, layer: GLint) | void | 354| invalidateFramebuffer(target: GLenum, attachments: GLenum[]) | void | 355| invalidateSubFramebuffer(target: GLenum, attachments: GLenum[], x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | 356| readBuffer(src: GLenum) | void | 357| getInternalformatParameter(target: GLenum, internalformat: GLenum, pname: GLenum) | any | 358| renderbufferStorageMultisample(target: GLenum, samples: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | 359| texStorage2D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei) | void | 360| texStorage3D(target: GLenum, levels: GLsizei, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei) | void | 361| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | 362| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | 363| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView \| null) | void | 364| texImage3D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | 365| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | 366| texSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | 367| 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 | 368| copyTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, x: GLint, y: GLint, width: GLsizei, height: GLsizei) | void | 369| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | 370| compressedTexImage3D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, depth: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | 371| compressedTexSubImage3D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, zoffset: GLint, width: GLsizei, height: GLsizei, depth: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | 372| 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 | 373| getFragDataLocation(program: WebGLProgram, name: string) | GLint | 374| uniform1ui(location: WebGLUniformLocation \| null, v0: GLuint) | void | 375| uniform2ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint) | void | 376| uniform3ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint) | void | 377| uniform4ui(location: WebGLUniformLocation \| null, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint) | void | 378| uniform1uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 379| uniform2uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 380| uniform3uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 381| uniform4uiv(location: WebGLUniformLocation \| null, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 382| uniformMatrix3x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 383| uniformMatrix4x2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 384| uniformMatrix2x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 385| uniformMatrix4x3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 386| uniformMatrix2x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 387| uniformMatrix3x4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 388| vertexAttribI4i(index: GLuint, x: GLint, y: GLint, z: GLint, w: GLint) | void | 389| vertexAttribI4iv(index: GLuint, values: Int32List) | void | 390| vertexAttribI4ui(index: GLuint, x: GLuint, y: GLuint, z: GLuint, w: GLuint) | void | 391| vertexAttribI4uiv(index: GLuint, values: Uint32List) | void | 392| vertexAttribIPointer(index: GLuint, size: GLint, type: GLenum, stride: GLsizei, offset: GLintptr) | void | 393| vertexAttribDivisor(index: GLuint, divisor: GLuint) | void | 394| drawArraysInstanced(mode: GLenum, first: GLint, count: GLsizei, instanceCount: GLsizei) | void | 395| drawElementsInstanced(mode: GLenum, count: GLsizei, type: GLenum, offset: GLintptr, instanceCount: GLsizei) | void | 396| drawRangeElements(mode: GLenum, start: GLuint, end: GLuint, count: GLsizei, type: GLenum, offset: GLintptr) | void | 397| drawBuffers(buffers: GLenum[]) | void | 398| clearBufferfv(buffer: GLenum, drawbuffer: GLint, values: Float32List, srcOffset?: GLuint) | void | 399| clearBufferiv(buffer: GLenum, drawbuffer: GLint, values: Int32List, srcOffset?: GLuint) | void | 400| clearBufferuiv(buffer: GLenum, drawbuffer: GLint, values: Uint32List, srcOffset?: GLuint) | void | 401| clearBufferfi(buffer: GLenum, drawbuffer: GLint, depth: GLfloat, stencil: GLint) | void | 402| createQuery() | WebGLQuery \| null | 403| deleteQuery(query: WebGLQuery \| null) | void | 404| isQuery(query: WebGLQuery \| null) | GLboolean | 405| beginQuery(target: GLenum, query: WebGLQuery) | void | 406| endQuery(target: GLenum) | void | 407| getQuery(target: GLenum, pname: GLenum) | WebGLQuery \| null | 408| getQueryParameter(query: WebGLQuery, pname: GLenum) | any | 409| createSampler() | WebGLSampler \| null | 410| deleteSampler(sampler: WebGLSampler \| null) | void | 411| isSampler(sampler: WebGLSampler \| null) | GLboolean | 412| bindSampler(unit: GLuint, sampler: WebGLSampler \| null) | void | 413| samplerParameteri(sampler: WebGLSampler, pname: GLenum, param: GLint) | void | 414| samplerParameterf(sampler: WebGLSampler, pname: GLenum, param: GLfloat) | void; | 415| getSamplerParameter(sampler: WebGLSampler, pname: GLenum) | any | 416| fenceSync(condition: GLenum, flags: GLbitfield) | WebGLSync \| null | 417| isSync(sync: WebGLSync \| null) | GLboolean | 418| deleteSync(sync: WebGLSync \| null) | void | 419| clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64) | GLenum | 420| waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64) | void | 421| getSyncParameter(sync: WebGLSync, pname: GLenum) | any | 422| createTransformFeedback() | WebGLTransformFeedback \| null | 423| deleteTransformFeedback(tf: WebGLTransformFeedback \| null) | void | 424| isTransformFeedback(tf: WebGLTransformFeedback \| null) | GLboolean | 425| bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedback \| null) | void | 426| beginTransformFeedback(primitiveMode: GLenum) | void | 427| endTransformFeedback() | void | 428| transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum) | void | 429| getTransformFeedbackVarying(program: WebGLProgram, index: GLuint) | WebGLActiveInfo \| null | 430| pauseTransformFeedback() | void | 431| resumeTransformFeedback() | void | 432| bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null) | void | 433| bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffer \| null, offset: GLintptr, size: GLsizeiptr) | void | 434| getIndexedParameter(target: GLenum, index: GLuint) | any | 435| getUniformIndices(program: WebGLProgram, uniformNames: string[]) | GLuint[] \| null | 436| getActiveUniforms(program: WebGLProgram, uniformIndices: GLuint[], pname: GLenum) | any | 437| getUniformBlockIndex(program: WebGLProgram, uniformBlockName: string) | GLuint | 438| getActiveUniformBlockParameter(program: WebGLProgram, uniformBlockIndex: GLuint, pname: GLenum) | any | 439| getActiveUniformBlockName(program: WebGLProgram, uniformBlockIndex: GLuint) | string \| null | 440| uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint) | void | 441| createVertexArray() | WebGLVertexArrayObject \| null | 442| deleteVertexArray(vertexArray: WebGLVertexArrayObject \| null) | void | 443| isVertexArray(vertexArray: WebGLVertexArrayObject \| null) | GLboolean | 444| bindVertexArray(array: WebGLVertexArrayObject \| null) | void | 445 446 447## WebGL2RenderingContextOverloads 448 449WebGL2RenderingContextOverloads 450 451 | 方法 | 返回值类型 | 452| -------- | -------- | 453| bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum) | void | 454| bufferData(target: GLenum, srcData: BufferSource \| null, usage: GLenum) | void | 455| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: BufferSource) | void | 456| bufferData(target: GLenum, srcData: ArrayBufferView, usage: GLenum, srcOffset: GLuint, length?: GLuint) | void | 457| bufferSubData(target: GLenum, dstByteOffset: GLintptr, srcData: ArrayBufferView, srcOffset: GLuint, length?: GLuint) | void | 458| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | 459| texImage2D(target: GLenum, level: GLint, internalformat: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | 460| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pixels: ArrayBufferView \| null) | void | 461| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | 462| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | 463| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, source: TexImageSource) | void | 464| texImage2D(target: GLenum, level: GLint, internalformat: GLint, width: GLsizei, height: GLsizei, border: GLint, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | 465| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, pboOffset: GLintptr) | void | 466| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, source: TexImageSource) | void | 467| texSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, srcData: ArrayBufferView, srcOffset: GLuint) | void | 468| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, imageSize: GLsizei, offset: GLintptr) | void | 469| compressedTexImage2D(target: GLenum, level: GLint, internalformat: GLenum, width: GLsizei, height: GLsizei, border: GLint, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | 470| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, imageSize: GLsizei, offset: GLintptr) | void | 471| compressedTexSubImage2D(target: GLenum, level: GLint, xoffset: GLint, yoffset: GLint, width: GLsizei, height: GLsizei, format: GLenum, srcData: ArrayBufferView, srcOffset?: GLuint, srcLengthOverride?: GLuint) | void | 472| uniform1fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 473| uniform2fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 474| uniform3fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 475| uniform4fv(location: WebGLUniformLocation \| null, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 476| uniform1iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 477| uniform2iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 478| uniform3iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 479| uniform4iv(location: WebGLUniformLocation \| null, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 480| uniformMatrix2fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 481| uniformMatrix3fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 482| uniformMatrix4fv(location: WebGLUniformLocation \| null, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint) | void | 483| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView \| null) | void | 484| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, offset: GLintptr) | void | 485| readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferView, dstOffset: GLuint) | void | 486