--- title: WebGLRenderingContext.createTexture() slug: Web/API/WebGLRenderingContext/createTexture translation_of: Web/API/WebGLRenderingContext/createTexture ---
WebGL API的WebGLRenderingContext.createTexture()
方法创建并初始化了一个{{domxref("WebGLTexture")}} 目标。
WebGLTexture gl.createTexture();
无。
一个可以被任何图像绑定的 {{domxref("WebGLTexture")}} 目标
另见 Using textures in WebGL上的WebGL tutorial
var canvas = document.getElementById('canvas'); var gl = canvas.getContext('webgl'); var texture = gl.createTexture();
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.8", "createTexture")}} | {{Spec2('WebGL')}} | Initial definition. |
{{SpecName('OpenGL ES 2.0', "glGenTextures.xml", "glGenTextures")}} | {{Spec2('OpenGL ES 2.0')}} | Man page of the (similar) OpenGL API. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.WebGLRenderingContext.createTexture")}}