跳到主要内容

clear 擦除纹理中的像素

clear

类型: MethodDeclaration

所属类: Texture

定义位置: webgl.ts

描述

擦除纹理中的像素

参数 red: 默认红色

参数 green: 默认绿色

参数 blue: 默认蓝色

参数 alpha: 默认不透明度

参数

参数名类型描述默认值
rednumber-n0
greennumber-n0
bluenumber-n0
alphanumber-n0

返回值

类型: void

源代码

位置: 第 2008 行

public clear(red: number = 0, green: number = 0, blue: number = 0, alpha: number = 0): void {
const gl = this.gl
gl.bindFBO(gl.frameBuffer)
gl.framebufferTexture2D(gl.FRAMEBUFFER, gl.COLOR_ATTACHMENT0, gl.TEXTURE_2D, this.base.glTexture, 0)
gl.clearColor(red, green, blue, alpha)
gl.clear(gl.COLOR_BUFFER_BIT)
gl.unbindFBO()
}

文档生成时间:2025/7/7 12:07:07