--- title: WebGLRenderingContext.deleteTexture() slug: Web/API/WebGLRenderingContext/deleteTexture translation_of: Web/API/WebGLRenderingContext/deleteTexture ---
{{APIRef("WebGL")}}
WebGLRenderingContext.deleteTexture()方法删除指定的{{domxref("WebGLTexture")}}对象。如果纹理已被删除,则此方法无效。

Syntax

void gl.deleteTexture(texture);

Parameters

texture
将要删除的{{domxref("WebGLTexture")}} 对象.

Return value

无.

Examples

Deleting a texture

var canvas = document.getElementById('canvas');
var gl = canvas.getContext('webgl');
var texture = gl.createTexture();

// ...

gl.deleteTexture(texture);

Specifications

Specification Status Comment
{{SpecName('WebGL', "#5.14.8", "deleteTexture")}} {{Spec2('WebGL')}} Initial definition.
{{SpecName('OpenGL ES 2.0', "glDeleteTextures.xml", "glDeleteTextures")}} {{Spec2('OpenGL ES 2.0')}} Man page of the (similar) OpenGL API.

Browser compatibility

{{Compat("api.WebGLRenderingContext.deleteTexture")}}

See also