WebGLRenderingContext.getShaderParameter()

WebGLRenderingContext.getShaderParameter() 返回给定的着色器信息

语法

any gl.getShaderParameter(shader, pname);

参数

shader
需要获取信息的着色器对象
pname
指定要查询的信息属性名称
values:
  • gl.DELETE_STATUS:标示着色器是否被删除,删除(GL_TRUE)未删除(GL_FALSE).
  • gl.COMPILE_STATUS: 标示着色器是否编译成功,是(GL_TRUE)不是(GL_FALSE
  • gl.SHADER_TYPE: 标示着色器类型,是顶点着色器(gl.VERTEX_SHADER)还是片段着色器(gl.FRAGMENT_SHADER)

返回值

返回对应着色器属性信息

例子

gl.getShaderParameter(shader, gl.SHADER_TYPE);

规范

Specification Status Comment
WebGL 1.0
getShaderParameter
Recommendation Initial definition.
OpenGL ES 2.0
glGetShaderiv
Standard Man page of the (similar) OpenGL API.

浏览器兼容性

Update compatibility data on GitHub
DesktopMobile
ChromeEdgeFirefoxInternet ExplorerOperaSafariAndroid webviewChrome for AndroidFirefox for AndroidOpera for AndroidSafari on iOSSamsung Internet
getShaderParameterChrome Full support 9Edge Full support 12Firefox Full support 4IE Full support 11Opera Full support 12Safari Full support 5.1WebView Android Full support YesChrome Android Full support 25Firefox Android Full support YesOpera Android Full support 12Safari iOS Full support 8.1Samsung Internet Android Full support Yes

Legend

Full support  
Full support

相关链接