The WebGLRenderingContext.getProgramParameter()
method of the WebGL API returns information about the given program.
Syntax
any gl.getProgramParameter(program, pname);
Parameters
- program
- A
WebGLProgram
to get parameter information from. - pname
- A
Glenum
specifying the information to query. Possible values:gl.DELETE_STATUS
: Returns aGLboolean
indicating whether or not the program is flagged for deletion.gl.LINK_STATUS
: Returns aGLboolean
indicating whether or not the last link operation was successful.gl.VALIDATE_STATUS
: Returns aGLboolean
indicating whether or not the last validation operation was successful.gl.ATTACHED_SHADERS
: Returns aGLint
indicating the number of attached shaders to a program.gl.ACTIVE_ATTRIBUTES
: Returns aGLint
indicating the number of active attribute variables to a program.gl.ACTIVE_UNIFORMS
: Returns aGLint
indicating the number of active uniform variables to a program.- When using a WebGL 2 context, the following values are available additionally:
gl.TRANSFORM_FEEDBACK_BUFFER_MODE
: Returns aGLenum
indicating the buffer mode when transform feedback is active. May begl.SEPARATE_ATTRIBS
orgl.INTERLEAVED_ATTRIBS
.gl.TRANSFORM_FEEDBACK_VARYINGS
: Returns aGLint
indicating the number of varying variables to capture in transform feedback mode.gl.ACTIVE_UNIFORM_BLOCKS
: Returns aGLint
indicating the number of uniform blocks containing active uniforms.
Return value
Returns the requested program information (as specified with pname
).
Examples
gl.getProgramParameter(program, gl.DELETE_STATUS);
Specifications
Specification | Status | Comment |
---|---|---|
WebGL 1.0 The definition of 'getProgramParameter' in that specification. |
Recommendation | Initial definition. |
OpenGL ES 2.0 The definition of 'glGetProgramiv' in that specification. |
Standard | Man page of the (similar) OpenGL API. |
WebGL 2.0 The definition of 'getProgramParameter' in that specification. |
Editor's Draft | Adds new pname values:gl.TRANSFORM_FEEDBACK_BUFFER_MODE ,gl.TRANSFORM_FEEDBACK_VARYINGS ,gl.ACTIVE_UNIFORM_BLOCKS |
Browser compatibility
Feature | Chrome | Edge | Firefox (Gecko) | Internet Explorer | Opera | Safari |
---|---|---|---|---|---|---|
Basic support | 9 | 12 | 4.0 (2.0) | 11 | 12 | 5.1 |
WebGL 2 | No support [2] | No support | Nightly build [1] | No support | No support | No support |
Feature | Android | Chrome for Android | Firefox Mobile (Gecko) | Firefox OS | IE Mobile | Opera Mobile | Safari Mobile |
---|---|---|---|---|---|---|---|
Basic support | ? | 25 | 4.0 (2.0) | 1.0 | ? | 12 | 8.0 |
WebGL 2 | No support | No support | No support | No support | No support | No support | No support |
[1] WebGL 2 is enabled by default in Firefox Nightly. To enable it in a release version of Firefox, set the preference webgl.enable-prototype-webgl2
to true
in about:config.
[2] To use an experimental implementation of WebGL 2 in Chrome, you have to start Chrome with the runtime flag --enable-unsafe-es3-apis
.