aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/webglrenderingcontext/getprogramparameter/index.html
blob: 9b69b0f71f5bf37ca915ac2d962e70b9756f586e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
---
title: WebGLRenderingContext.getProgramParameter()
slug: Web/API/WebGLRenderingContext/getProgramParameter
translation_of: Web/API/WebGLRenderingContext/getProgramParameter
---
<div>{{APIRef("WebGL")}}</div>

<p><strong><code>WebGLRenderingContext.getProgramParameter()</code></strong> 方法返回<code><a href="https://developer.mozilla.org/en-US/docs/Web/API/WebGLProgram" title="The WebGLProgram is part of the WebGL API and is a combination of two compiled WebGLShaders consisting of a vertex shader and a fragment shader (both written in GLSL).">WebGLProgram</a>的信息。</code></p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox">any <var>gl</var>.getProgramParameter(<var>program</var>, <var>pname</var>);
</pre>

<h3 id="参数">参数</h3>

<dl>
 <dt>program</dt>
 <dd>A {{domxref("WebGLProgram")}} to get parameter information from.</dd>
 <dt>pname</dt>
 <dd>A {{domxref("Glenum")}} specifying the information to query. Possible values:
 <ul>
  <li><code>gl.DELETE_STATUS</code>: Returns a {{domxref("GLboolean")}} indicating whether or not the program is flagged for deletion.</li>
  <li><code>gl.LINK_STATUS</code>: Returns a {{domxref("GLboolean")}} indicating whether or not the last link operation was successful.</li>
  <li><code>gl.VALIDATE_STATUS</code>: Returns a {{domxref("GLboolean")}} indicating whether or not the last validation operation was successful.</li>
  <li><code>gl.ATTACHED_SHADERS</code>: Returns a {{domxref("GLint")}} indicating the number of attached shaders to a program.</li>
  <li><code>gl.ACTIVE_ATTRIBUTES</code>: Returns a {{domxref("GLint")}} indicating the number of active attribute variables to a program.</li>
  <li><code>gl.ACTIVE_UNIFORMS</code>: Returns a {{domxref("GLint")}} indicating the number of active uniform variables to a program.</li>
  <li>When using a {{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}}, the following values are available additionally:
   <ul>
    <li><code>gl.TRANSFORM_FEEDBACK_BUFFER_MODE</code>: Returns a {{domxref("GLenum")}} indicating the buffer mode when transform feedback is active. May be <code>gl.SEPARATE_ATTRIBS</code> or <code>gl.INTERLEAVED_ATTRIBS</code>.</li>
    <li><code>gl.TRANSFORM_FEEDBACK_VARYINGS</code>: Returns a {{domxref("GLint")}} indicating the number of varying variables to capture in transform feedback mode.</li>
    <li><code>gl.ACTIVE_UNIFORM_BLOCKS</code>: Returns a {{domxref("GLint")}} indicating the number of uniform blocks containing active uniforms.</li>
   </ul>
  </li>
 </ul>
 </dd>
</dl>

<h3 id="返回值">返回值</h3>

<p>Returns the requested program information (as specified with <code>pname</code>).</p>

<h2 id="例子">例子</h2>

<pre class="brush: js">gl.getProgramParameter(program, gl.DELETE_STATUS);
</pre>

<h2 id="Specifications">Specifications</h2>

<table class="standard-table">
 <tbody>
  <tr>
   <th scope="col">Specification</th>
   <th scope="col">Status</th>
   <th scope="col">Comment</th>
  </tr>
  <tr>
   <td>{{SpecName('WebGL', "#5.14.9", "getProgramParameter")}}</td>
   <td>{{Spec2('WebGL')}}</td>
   <td>Initial definition.</td>
  </tr>
  <tr>
   <td>{{SpecName('OpenGL ES 2.0', "glGetProgramiv.xml", "glGetProgramiv")}}</td>
   <td>{{Spec2('OpenGL ES 2.0')}}</td>
   <td>Man page of the (similar) OpenGL API.</td>
  </tr>
  <tr>
   <td>{{SpecName('WebGL2', "#3.7.7", "getProgramParameter")}}</td>
   <td>{{Spec2('WebGL2')}}</td>
   <td>Adds new <code>pname</code> values:<br>
    <code>gl.TRANSFORM_FEEDBACK_BUFFER_MODE</code>,<br>
    <code>gl.TRANSFORM_FEEDBACK_VARYINGS</code>,<br>
    <code>gl.ACTIVE_UNIFORM_BLOCKS</code></td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

<p>{{Compat("api.WebGLRenderingContext.getProgramParameter")}}</p>

<h2 id="See_also">See also</h2>

<ul>
 <li>{{domxref("WebGLRenderingContext.getShaderParameter()")}}</li>
</ul>