WebGLRenderingContext:createTexture() 方法

WebGL APIWebGLRenderingContext.createTexture() 方法创建并初始化 WebGLTexture 对象。

语法

js
createTexture()

参数

无。

返回值

一个可以被任何图像绑定的 WebGLTexture 对象。

示例

创建纹理

js
const canvas = document.getElementById("canvas");
const gl = canvas.getContext("webgl");
const texture = gl.createTexture();

规范

Specification
WebGL Specification
# 5.14.8

浏览器兼容性

BCD tables only load in the browser

参见