Please note, this is a STATIC archive of website developer.mozilla.org from 03 Nov 2016, cach3.com does not collect or store any user information, there is no "phishing" involved.

Revision 1032092 of WebGLUniformLocation

  • Revision slug: Web/API/WebGLUniformLocation
  • Revision title: WebGLUniformLocation
  • Revision id: 1032092
  • Created:
  • Creator: atul
  • Is current revision? Yes
  • Comment
Tags: 

Revision Content

{{APIRef("WebGL")}}

The WebGLUniformLocation interface is part of the WebGL API and represents the location of a uniform variable in a shader program.

Description

The WebGLUniformLocation object does not define any methods or properties of its own and its content is not directly accessible. When working with WebGLUniformLocation objects, the following methods of the {{domxref("WebGLRenderingContext")}} are useful:

  • {{domxref("WebGLRenderingContext.getUniformLocation()")}}
  • {{domxref("WebGLRenderingContext.uniform()")}}

Examples

Getting an uniform location

var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");

var location = gl.getUniformLocation(WebGLProgram, "uniformName");

Specifications

Specification Status Comment
{{SpecName('WebGL', "#5.10", "WebGLUniformLocation")}} {{Spec2('WebGL')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatChrome("9")}} {{CompatGeckoDesktop("2.0")}} {{CompatIE("11")}} {{CompatOpera("12")}} {{CompatSafari("5.1")}}
Available in workers {{CompatNo}} {{CompatGeckoDesktop(44)}} [1] {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} 25 {{CompatVersionUnknown}} {{CompatUnknown}} 12 8.1
Available in workers {{CompatNo}} {{CompatNo}} {{CompatGeckomobile(44)}} [1] {{CompatNo}} {{CompatNo}} {{CompatNo}}

[1] This feature is behind a feature preference setting. In about:config, set gfx.offscreencanvas.enabled to true.

See also

  • {{domxref("WebGLRenderingContext.getUniformLocation()")}}

Revision Source

<div>{{APIRef("WebGL")}}</div>

<p>The <strong>WebGLUniformLocation</strong> interface is part of the <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> and represents the location of a uniform variable in a shader program.</p>

<h2 id="Description">Description</h2>

<p>The <code>WebGLUniformLocation</code> object does not define any methods or properties of its own and its content is not directly accessible. When working with <code>WebGLUniformLocation</code> objects, the following methods of the {{domxref("WebGLRenderingContext")}} are useful:</p>

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

<h2 id="Examples">Examples</h2>

<h3 id="Getting_an_uniform_location">Getting an uniform location</h3>

<pre class="brush: js">
var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");

var location = gl.getUniformLocation(WebGLProgram, "uniformName");</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.10", "WebGLUniformLocation")}}</td>
   <td>{{Spec2('WebGL')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

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

<div>{{CompatibilityTable}}</div>

<div id="compat-desktop">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Chrome</th>
   <th>Firefox (Gecko)</th>
   <th>Internet Explorer</th>
   <th>Opera</th>
   <th>Safari</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatChrome("9")}}</td>
   <td>{{CompatGeckoDesktop("2.0")}}</td>
   <td>{{CompatIE("11")}}</td>
   <td>{{CompatOpera("12")}}</td>
   <td>{{CompatSafari("5.1")}}</td>
  </tr>
  <tr>
   <td>Available in workers</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckoDesktop(44)}} [1]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<div id="compat-mobile">
<table class="compat-table">
 <tbody>
  <tr>
   <th>Feature</th>
   <th>Android</th>
   <th>Chrome for Android</th>
   <th>Firefox Mobile (Gecko)</th>
   <th>IE Mobile</th>
   <th>Opera Mobile</th>
   <th>Safari Mobile</th>
  </tr>
  <tr>
   <td>Basic support</td>
   <td>{{CompatUnknown}}</td>
   <td>25</td>
   <td>{{CompatVersionUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>12</td>
   <td>8.1</td>
  </tr>
  <tr>
   <td>Available in workers</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatGeckomobile(44)}} [1]</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] This feature is behind a feature preference setting. In about:config, set <code>gfx.offscreencanvas.enabled</code> to <code>true</code>.</p>

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

<ul>
 <li>{{domxref("WebGLRenderingContext.getUniformLocation()")}}</li>
</ul>
Revert to this revision