鸿蒙开发接口图形图像:【WebGL2】

电子说

1.3w人已加入

描述

WebGL2

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

WebGL标准图形API,对应OpenGL ES 3.0特性集。

说明:
开发前请熟悉鸿蒙开发指导文档 :[gitee.com/li-shizhen-skin/harmony-os/blob/master/README.md]
本模块首批接口从API version 7开始支持。后续版本的新增接口,采用上角标单独标记接口的起始版本。

调用方式

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

名称类型
GLenumnumber
GLint64number
GLuint64number
Uint32Listarray

Interface

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

表2 Interface

名称
[WebGL2RenderingContextBase]
[WebGL2RenderingContextOverloads]
WebGLQuery
WebGLSampler
WebGLSync
WebGLTransformFeedback
WebGLVertexArrayObject

WebGL2RenderingContextBase

WebGL2RenderingContextBase

属性

名称参数类型必填
READ_BUFFERGLenum
UNPACK_ROW_LENGTHGLenum
UNPACK_SKIP_ROWSGLenum
UNPACK_SKIP_PIXELSGLenum
PACK_ROW_LENGTHGLenum
PACK_SKIP_ROWSGLenum
PACK_SKIP_PIXELSGLenum
COLORGLenum
DEPTHGLenum
STENCILGLenum
REDGLenum
RGB8GLenum
RGBA8GLenum
RGB10_A2GLenum
TEXTURE_BINDING_3DGLenum
UNPACK_SKIP_IMAGESGLenum
UNPACK_IMAGE_HEIGHTGLenum
TEXTURE_3DGLenum
TEXTURE_WRAP_RGLenum
MAX_3D_TEXTURE_SIZEGLenum
UNSIGNED_INT_2_10_10_10_REVGLenum
MAX_ELEMENTS_VERTICESGLenum
MAX_ELEMENTS_INDICESGLenum
TEXTURE_MIN_LODGLenum
TEXTURE_MAX_LODGLenum
TEXTURE_BASE_LEVELGLenum
TEXTURE_MAX_LEVELGLenum
MINGLenum
MAXGLenum
DEPTH_COMPONENT24GLenum
MAX_TEXTURE_LOD_BIASGLenum
TEXTURE_COMPARE_MODEGLenum
TEXTURE_COMPARE_FUNCGLenum
CURRENT_QUERYGLenum
QUERY_RESULTGLenum
QUERY_RESULT_AVAILABLEGLenum
STREAM_READGLenum
STREAM_COPYGLenum
STATIC_READGLenum
STATIC_COPYGLenum
DYNAMIC_READGLenum
DYNAMIC_COPYGLenum
MAX_DRAW_BUFFERSGLenum
DRAW_BUFFER0GLenum
DRAW_BUFFER1GLenum
DRAW_BUFFER2GLenum
DRAW_BUFFER3GLenum
DRAW_BUFFER4GLenum
DRAW_BUFFER5GLenum
DRAW_BUFFER6GLenum
DRAW_BUFFER7GLenum
DRAW_BUFFER8GLenum
DRAW_BUFFER9GLenum
DRAW_BUFFER10GLenum
DRAW_BUFFER11GLenum
DRAW_BUFFER12GLenum
DRAW_BUFFER13GLenum
DRAW_BUFFER14GLenum
DRAW_BUFFER15GLenum
MAX_FRAGMENT_UNIFORM_COMPONENTSGLenum
MAX_VERTEX_UNIFORM_COMPONENTSGLenum
SAMPLER_3DGLenum
SAMPLER_2D_SHADOWGLenum
FRAGMENT_SHADER_DERIVATIVE_HINTGLenum
PIXEL_PACK_BUFFERGLenum
PIXEL_UNPACK_BUFFERGLenum
PIXEL_PACK_BUFFER_BINDINGGLenum
PIXEL_UNPACK_BUFFER_BINDINGGLenum
FLOAT_MAT2x3GLenum
FLOAT_MAT2x4GLenum
FLOAT_MAT3x2GLenum
FLOAT_MAT3x4GLenum
FLOAT_MAT4x2GLenum
FLOAT_MAT4x3GLenum
SRGBGLenum
SRGB8GLenum
SRGB8_ALPHA8GLenum
COMPARE_REF_TO_TEXTUREGLenum
RGBA32FGLenum
RGB32FGLenum
RGBA16FGLenum
RGB16FGLenum
VERTEX_ATTRIB_ARRAY_INTEGERGLenum
MAX_ARRAY_TEXTURE_LAYERSGLenum
MIN_PROGRAM_TEXEL_OFFSETGLenum
MAX_PROGRAM_TEXEL_OFFSETGLenum
MAX_VARYING_COMPONENTSGLenum
TEXTURE_2D_ARRAYGLenum
TEXTURE_BINDING_2D_ARRAYGLenum
R11F_G11F_B10FGLenum
UNSIGNED_INT_10F_11F_11F_REVGLenum
RGB9_E5GLenum
UNSIGNED_INT_5_9_9_9_REVGLenum
TRANSFORM_FEEDBACK_BUFFER_MODEGLenum
MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTSGLenum
TRANSFORM_FEEDBACK_VARYINGSGLenum
TRANSFORM_FEEDBACK_BUFFER_STARTGLenum
TRANSFORM_FEEDBACK_BUFFER_SIZEGLenum
TRANSFORM_FEEDBACK_PRIMITIVES_WRITTENGLenum
RASTERIZER_DISCARDGLenum
MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTSGLenum
MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBSGLenum
INTERLEAVED_ATTRIBSGLenum
SEPARATE_ATTRIBSGLenum
TRANSFORM_FEEDBACK_BUFFERGLenum
TRANSFORM_FEEDBACK_BUFFER_BINDINGGLenum
RGBA32UIGLenum
RGB32UIGLenum
RGBA16UIGLenum
RGB16UIGLenum
RGBA8UIGLenum
RGB8UIGLenum
RGBA32IGLenum
RGB32IGLenum
RGBA16IGLenum
RGB16IGLenum
RGBA8IGLenum
RGB8IGLenum
RED_INTEGERGLenum
RGB_INTEGERGLenum
RGBA_INTEGERGLenum
SAMPLER_2D_ARRAYGLenum
SAMPLER_2D_ARRAY_SHADOWGLenum
SAMPLER_CUBE_SHADOWGLenum
UNSIGNED_INT_VEC2GLenum
UNSIGNED_INT_VEC3GLenum
UNSIGNED_INT_VEC4GLenum
INT_SAMPLER_2DGLenum
INT_SAMPLER_3DGLenum
INT_SAMPLER_CUBEGLenum
INT_SAMPLER_2D_ARRAYGLenum
UNSIGNED_INT_SAMPLER_2DGLenum
UNSIGNED_INT_SAMPLER_3DGLenum
UNSIGNED_INT_SAMPLER_CUBEGLenum
UNSIGNED_INT_SAMPLER_2D_ARRAYGLenum
DEPTH_COMPONENT32FGLenum
DEPTH32F_STENCIL8GLenum
FLOAT_32_UNSIGNED_INT_24_8_REVGLenum
FRAMEBUFFER_ATTACHMENT_COLOR_ENCODINGGLenum
FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPEGLenum
FRAMEBUFFER_ATTACHMENT_RED_SIZEGLenum
FRAMEBUFFER_ATTACHMENT_GREEN_SIZEGLenum
FRAMEBUFFER_ATTACHMENT_BLUE_SIZEGLenum
FRAMEBUFFER_ATTACHMENT_ALPHA_SIZEGLenum
FRAMEBUFFER_ATTACHMENT_DEPTH_SIZEGLenum
FRAMEBUFFER_ATTACHMENT_STENCIL_SIZEGLenum
FRAMEBUFFER_DEFAULTGLenum
UNSIGNED_INT_24_8GLenum
DEPTH24_STENCIL8GLenum
UNSIGNED_NORMALIZEDGLenum
DRAW_FRAMEBUFFER_BINDINGGLenum
READ_FRAMEBUFFERGLenum
DRAW_FRAMEBUFFERGLenum
READ_FRAMEBUFFER_BINDINGGLenum
RENDERBUFFER_SAMPLESGLenum
FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYERGLenum
MAX_COLOR_ATTACHMENTSGLenum
COLOR_ATTACHMENT1GLenum
COLOR_ATTACHMENT2GLenum
COLOR_ATTACHMENT3GLenum
COLOR_ATTACHMENT4GLenum
COLOR_ATTACHMENT5GLenum
COLOR_ATTACHMENT6GLenum
COLOR_ATTACHMENT7GLenum
COLOR_ATTACHMENT8GLenum
COLOR_ATTACHMENT9GLenum
COLOR_ATTACHMENT10GLenum
COLOR_ATTACHMENT11GLenum
COLOR_ATTACHMENT12GLenum
COLOR_ATTACHMENT13GLenum
COLOR_ATTACHMENT14GLenum
COLOR_ATTACHMENT15GLenum
FRAMEBUFFER_INCOMPLETE_MULTISAMPLEGLenum
MAX_SAMPLESGLenum
HALF_FLOATGLenum
RGGLenum
RG_INTEGERGLenum
R8GLenum
RG8GLenum
R16FGLenum
R32FGLenum
RG16FGLenum
RG32FGLenum
R8IGLenum
R8UIGLenum
R16IGLenum
R16UIGLenum
R32IGLenum
R32UIGLenum
RG8IGLenum
RG8UIGLenum
RG16IGLenum
RG16UIGLenum
RG32IGLenum
RG32UIGLenum
VERTEX_ARRAY_BINDINGGLenum
R8_SNORMGLenum
RG8_SNORMGLenum
RGB8_SNORMGLenum
SIGNED_NORMALIZEDGLenum
COPY_READ_BUFFERGLenum
COPY_WRITE_BUFFERGLenum
COPY_READ_BUFFER_BINDINGGLenum
COPY_WRITE_BUFFER_BINDINGGLenum
UNIFORM_BUFFERGLenum
UNIFORM_BUFFER_BINDINGGLenum
UNIFORM_BUFFER_STARTGLenum
UNIFORM_BUFFER_SIZEGLenum
MAX_VERTEX_UNIFORM_BLOCKSGLenum
MAX_FRAGMENT_UNIFORM_BLOCKSGLenum
MAX_COMBINED_UNIFORM_BLOCKSGLenum
MAX_UNIFORM_BUFFER_BINDINGSGLenum
MAX_UNIFORM_BLOCK_SIZEGLenum
MAX_COMBINED_VERTEX_UNIFORM_COMPONENTSGLenum
MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTSGLenum
UNIFORM_BUFFER_OFFSET_ALIGNMENTGLenum
ACTIVE_UNIFORM_BLOCKSGLenum
UNIFORM_TYPEGLenum
UNIFORM_SIZEGLenum
UNIFORM_BLOCK_INDEXGLenum
UNIFORM_OFFSETGLenum
UNIFORM_ARRAY_STRIDEGLenum
UNIFORM_MATRIX_STRIDEGLenum
UNIFORM_IS_ROW_MAJORGLenum
UNIFORM_BLOCK_BINDINGGLenum
UNIFORM_BLOCK_DATA_SIZEGLenum
UNIFORM_BLOCK_ACTIVE_UNIFORMSGLenum
UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICESGLenum
UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADERGLenum
UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADERGLenum
INVALID_INDEXGLenum
MAX_VERTEX_OUTPUT_COMPONENTSGLenum
MAX_FRAGMENT_INPUT_COMPONENTSGLenum
MAX_SERVER_WAIT_TIMEOUTGLenum
OBJECT_TYPEGLenum
SYNC_CONDITIONGLenum
SYNC_STATUSGLenum
SYNC_FLAGSGLenum
SYNC_FENCEGLenum
SYNC_GPU_COMMANDS_COMPLETEGLenum
UNSIGNALEDGLenum
SIGNALEDGLenum
ALREADY_SIGNALEDGLenum
TIMEOUT_EXPIREDGLenum
CONDITION_SATISFIEDGLenum
WAIT_FAILEDGLenum
SYNC_FLUSH_COMMANDS_BITGLenum
VERTEX_ATTRIB_ARRAY_DIVISORGLenum
ANY_SAMPLES_PASSEDGLenum
ANY_SAMPLES_PASSED_CONSERVATIVEGLenum
SAMPLER_BINDINGGLenum
RGB10_A2UIGLenum
INT_2_10_10_10_REVGLenum
TRANSFORM_FEEDBACKGLenum
TRANSFORM_FEEDBACK_PAUSEDGLenum
TRANSFORM_FEEDBACK_ACTIVEGLenum
TRANSFORM_FEEDBACK_BINDINGGLenum
TEXTURE_IMMUTABLE_FORMATGLenum
MAX_ELEMENT_INDEXGLenum
TEXTURE_IMMUTABLE_LEVELSGLenum
TIMEOUT_IGNOREDGLint64
MAX_CLIENT_WAIT_TIMEOUT_WEBGLGLenum

方法

方法返回值类型
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: WebGLTexturenull, level: GLint, layer: GLint)
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: ArrayBufferViewnull)
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: ArrayBufferViewnull, srcOffset?: GLuint)
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: WebGLUniformLocationnull, v0: GLuint)
uniform2ui(location: WebGLUniformLocationnull, v0: GLuint, v1: GLuint)
uniform3ui(location: WebGLUniformLocationnull, v0: GLuint, v1: GLuint, v2: GLuint)
uniform4ui(location: WebGLUniformLocationnull, v0: GLuint, v1: GLuint, v2: GLuint, v3: GLuint)
uniform1uiv(location: WebGLUniformLocationnull, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform2uiv(location: WebGLUniformLocationnull, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform3uiv(location: WebGLUniformLocationnull, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform4uiv(location: WebGLUniformLocationnull, data: Uint32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix3x2fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix4x2fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix2x3fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix4x3fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix2x4fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix3x4fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
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
deleteQuery(query: WebGLQuerynull)
isQuery(query: WebGLQuerynull)
beginQuery(target: GLenum, query: WebGLQuery)void
endQuery(target: GLenum)void
getQuery(target: GLenum, pname: GLenum)WebGLQuery
getQueryParameter(query: WebGLQuery, pname: GLenum)any
createSampler()WebGLSampler
deleteSampler(sampler: WebGLSamplernull)
isSampler(sampler: WebGLSamplernull)
bindSampler(unit: GLuint, sampler: WebGLSamplernull)
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
isSync(sync: WebGLSyncnull)
deleteSync(sync: WebGLSyncnull)
clientWaitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLuint64)GLenum
waitSync(sync: WebGLSync, flags: GLbitfield, timeout: GLint64)void
getSyncParameter(sync: WebGLSync, pname: GLenum)any
createTransformFeedback()WebGLTransformFeedback
deleteTransformFeedback(tf: WebGLTransformFeedbacknull)
isTransformFeedback(tf: WebGLTransformFeedbacknull)
bindTransformFeedback(target: GLenum, tf: WebGLTransformFeedbacknull)
beginTransformFeedback(primitiveMode: GLenum)void
endTransformFeedback()void
transformFeedbackVaryings(program: WebGLProgram, varyings: string[], bufferMode: GLenum)void
getTransformFeedbackVarying(program: WebGLProgram, index: GLuint)WebGLActiveInfo
pauseTransformFeedback()void
resumeTransformFeedback()void
bindBufferBase(target: GLenum, index: GLuint, buffer: WebGLBuffernull)
bindBufferRange(target: GLenum, index: GLuint, buffer: WebGLBuffernull, offset: GLintptr, size: GLsizeiptr)
getIndexedParameter(target: GLenum, index: GLuint)any
getUniformIndices(program: WebGLProgram, uniformNames: string[])GLuint[]
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
uniformBlockBinding(program: WebGLProgram, uniformBlockIndex: GLuint, uniformBlockBinding: GLuint)void
createVertexArray()WebGLVertexArrayObject
deleteVertexArray(vertexArray: WebGLVertexArrayObjectnull)
isVertexArray(vertexArray: WebGLVertexArrayObjectnull)
bindVertexArray(array: WebGLVertexArrayObjectnull)

WebGL2RenderingContextOverloads

WebGL2RenderingContextOverloads

接口

方法HarmonyOS与OpenHarmony鸿蒙文档籽料:mau123789是v直接拿返回值类型
bufferData(target: GLenum, size: GLsizeiptr, usage: GLenum)void
bufferData(target: GLenum, srcData: BufferSourcenull, usage: GLenum)
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: ArrayBufferViewnull)
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: ArrayBufferViewnull)
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: WebGLUniformLocationnull, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform2fv(location: WebGLUniformLocationnull, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform3fv(location: WebGLUniformLocationnull, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform4fv(location: WebGLUniformLocationnull, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform1iv(location: WebGLUniformLocationnull, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform2iv(location: WebGLUniformLocationnull, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform3iv(location: WebGLUniformLocationnull, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint)
uniform4iv(location: WebGLUniformLocationnull, data: Int32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix2fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix3fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
uniformMatrix4fv(location: WebGLUniformLocationnull, transpose: GLboolean, data: Float32List, srcOffset?: GLuint, srcLength?: GLuint)
readPixels(x: GLint, y: GLint, width: GLsizei, height: GLsizei, format: GLenum, type: GLenum, dstData: ArrayBufferViewnull)
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

审核编辑 黄宇

打开APP阅读更多精彩内容
声明:本文内容及配图由入驻作者撰写或者入驻合作网站授权转载。文章观点仅代表作者本人,不代表电子发烧友网立场。文章及其配图仅供工程师学习之用,如有内容侵权或者其他违规问题,请联系本站处理。 举报投诉

全部0条评论

快来发表一下你的评论吧 !

×
20
完善资料,
赚取积分