blob: f53554eb1d21bb01c48ae845022d48ceaebaa393 (
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
|
---
title: WebGLUniformLocation
slug: Web/API/WebGLUniformLocation
tags:
- API
- WebGL
- WebGLUniformLocation
translation_of: Web/API/WebGLUniformLocation
---
<div>{{APIRef("WebGL")}}</div>
<p><strong>WebGLUniformLocation</strong> 接口是 <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> 的一部分,在一个着色器程序中表示一个统一变量的位置。</p>
<h2 id="说明:">说明:</h2>
<p><code>WebGLUniformLocation</code> 对象未定义任何属于自己并能直接访问其内容的方法和属性。在使用 <code>WebGLUniformLocation</code> 对象时,{{domxref("WebGLRenderingContext")}} 的方法是有用的:</p>
<ul>
<li>{{domxref("WebGLRenderingContext.getUniformLocation()")}}</li>
<li>{{domxref("WebGLRenderingContext.uniform()")}}</li>
</ul>
<h2 id="示例:">示例:</h2>
<h3 id="获取一个统一位置">获取一个统一位置</h3>
<pre class="brush: js">var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");
var location = gl.getUniformLocation(WebGLProgram, "uniformName");</pre>
<h2 id="规格:">规格:</h2>
<table class="standard-table">
<tbody>
<tr>
<th scope="col">规格</th>
<th scope="col">状态</th>
<th scope="col">注释</th>
</tr>
<tr>
<td>{{SpecName('WebGL', "#5.10", "WebGLUniformLocation")}}</td>
<td>{{Spec2('WebGL')}}</td>
<td>初始的定义。</td>
</tr>
</tbody>
</table>
<h2 id="浏览器兼容性:">浏览器兼容性:</h2>
{{Compat("api.WebGLUniformLocation")}}
<h2 id="另请参阅:">另请参阅:</h2>
<ul>
<li>{{domxref("WebGLRenderingContext.getUniformLocation()")}}</li>
</ul>
|