--- title: WebGLRenderingContext.isProgram() slug: Web/API/WebGLRenderingContext/isProgram translation_of: Web/API/WebGLRenderingContext/isProgram ---
{{APIRef("WebGL")}}
WebGL API中的WebGLRenderingContext.isProgram() 函数 将会在{{domxref("WebGLProgram")}}是一个合法的着色器程序(program)时返回 true , 而在其他情况返回false
GLboolean gl.isProgram(program);
一个表示program是否有效的 {{domxref("GLboolean")}} 值.
var canvas = document.getElementById('canvas');
var gl = canvas.getContext('webgl');
var program = gl.createProgram();
// ...
gl.isProgram(program);
| Specification | Status | Comment |
|---|---|---|
| {{SpecName('WebGL', "#5.14.9", "isProgram")}} | {{Spec2('WebGL')}} | Initial definition. |
| {{SpecName('OpenGL ES 2.0', "glIsProgram.xml", "glIsProgram")}} | {{Spec2('OpenGL ES 2.0')}} | Man page of the OpenGL API. |
{{Compat("api.WebGLRenderingContext.isProgram")}}