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 1044614 of WebGLSampler

  • Revision slug: Web/API/WebGLSampler
  • Revision title: WebGLSampler
  • Revision id: 1044614
  • Created:
  • Creator: fscholz
  • Is current revision? Yes
  • Comment new page

Revision Content

{{APIRef("WebGL")}} {{SeeCompatTable}}

The WebGLSampler interface is part of the WebGL 2 API and stores sampling parameters for {{domxref("WebGLTexture")}} access inside of a shader.

When working with WebGLSampler objects, the following methods of the {{domxref("WebGL2RenderingContext")}} are useful:

  • {{domxref("WebGL2RenderingContext.createSampler()")}}
  • {{domxref("WebGL2RenderingContext.deleteSampler()")}}
  • {{domxref("WebGL2RenderingContext.isSampler()")}}
  • {{domxref("WebGL2RenderingContext.bindSampler()")}}
  • {{domxref("WebGL2RenderingContext.getSamplerParameter()")}}

Examples

Creating a WebGLSampler object

in this example, gl must be a {{domxref("WebGL2RenderingContext")}}. WebGLSampler objects are not available in WebGL 1.

var sampler = gl.createSampler();

Specifications

Specification Status Comment
{{SpecName('WebGL2', "#3.3", "WebGLSample")}} {{Spec2('WebGL2')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatNo}} [2] {{CompatNightly}} [1] {{CompatNo}} {{CompatNo}} {{CompatNo}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}} {{CompatNo}}

[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.

Revision Source

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

<p>The <strong><code>WebGLSampler</code></strong> interface is part of the <a href="/en-US/docs/Web/API/WebGL_API">WebGL 2</a> API and stores sampling parameters for {{domxref("WebGLTexture")}} access inside of a shader.</p>

<p>When working with <code>WebGLSampler</code> objects, the following methods of the {{domxref("WebGL2RenderingContext")}} are useful:</p>

<ul>
 <li>{{domxref("WebGL2RenderingContext.createSampler()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.deleteSampler()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.isSampler()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.bindSampler()")}}</li>
 <li>{{domxref("WebGL2RenderingContext.getSamplerParameter()")}}</li>
</ul>

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

<h3 id="Creating_a_WebGLQuery_object">Creating a <code>WebGLSampler</code> object</h3>

<p>in this example, <code>gl</code> must be a {{domxref("WebGL2RenderingContext")}}. <code>WebGLSampler</code> objects are not available in WebGL 1.</p>

<pre class="brush: js">
var sampler = gl.createSampler();
</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('WebGL2', "#3.3", "WebGLSample")}}</td>
   <td>{{Spec2('WebGL2')}}</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>{{CompatNo}} [2]</td>
   <td>{{CompatNightly}} [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>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
   <td>{{CompatNo}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] WebGL 2 is enabled by default in Firefox Nightly. To enable it in a release version of Firefox, set the preference <code>webgl.enable-prototype-webgl2</code> to <code>true</code> in about:config.</p>

<p>[2] To use an experimental implementation of WebGL 2 in Chrome, you have to start Chrome with the runtime flag <code>--enable-unsafe-es3-apis</code>.</p>
Revert to this revision