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 1011943 of EXT_texture_filter_anisotropic

  • Revision slug: Web/API/EXT_texture_filter_anisotropic
  • Revision title: EXT_texture_filter_anisotropic
  • Revision id: 1011943
  • Created:
  • Creator: fscholz
  • Is current revision? No
  • Comment

Revision Content

{{APIRef("WebGL")}}

The EXT_texture_filter_anisotropic extension is part of the WebGL API and exposes two constants for anisotropic filtering (AF).

AF improves the quality of mipmapped texture access when viewing a textured primitive at an oblique angle. Using just mipmapping, these lookups have a tendency to average to grey.

WebGL extensions are available using the {{domxref("WebGLRenderingContext.getExtension()")}} method. For more information, see also Using Extensions in the WebGL tutorial.

Constants

ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT
This is the pname argument to the {{domxref("WebGLRenderingContext.getParameter", "gl.getParameter()")}} call, and it returns the maximum available anisotropy.
ext.TEXTURE_MAX_ANISOTROPY_EXT
This is the pname argument to the {{domxref("WebGLRenderingContext.texParameter", "gl.texParameter()")}} and {{domxref("WebGLRenderingContext.getTexParameterf", "gl.getTexParameterf()")}}/{{domxref("WebGLRenderingContext.getTexParameteri", "gl.getTexParameteri()")}} calls and sets the desired maximum anisotropy for a texture.

Examples

var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
var ext = (
  gl.getExtension('EXT_texture_filter_anisotropic') ||
  gl.getExtension('MOZ_EXT_texture_filter_anisotropic') ||
  gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic')
);
if (ext){
  var max = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
  gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);
}

Specifications

Specification Status Comment
{{SpecName('EXT_texture_filter_anisotropic', "", "EXT_texture_filter_anisotropic")}} {{Spec2('EXT_texture_filter_anisotropic')}} Initial definition.

Browser compatibility

{{CompatibilityTable}}
Feature Chrome Firefox (Gecko) Internet Explorer Opera Safari
Basic support {{CompatUnknown}} {{CompatGeckoDesktop(17)}} [1] {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}
Feature Android Chrome for Android Firefox Mobile (Gecko) IE Mobile Opera Mobile Safari Mobile
Basic support {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}} {{CompatUnknown}}

[1] This extension was prefixed as MOZ_EXT_texture_filter_anisotropic in prior versions.

See also

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

Revision Source

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

<p>The <code><strong>EXT_texture_filter_anisotropic</strong></code> extension is part of the <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> and exposes two constants for <a href="https://en.wikipedia.org/wiki/Anisotropic_filtering">anisotropic filtering (AF)</a>.</p>

<p>AF improves the quality of mipmapped texture access when viewing a textured primitive at an oblique angle. Using just mipmapping, these lookups have a tendency to average to grey.</p>

<p>WebGL extensions are available using the {{domxref("WebGLRenderingContext.getExtension()")}} method. For more information, see also <a href="/en-US/docs/Web/API/WebGL_API/Using_Extensions">Using Extensions</a> in the <a href="/en-US/docs/Web/API/WebGL_API/Tutorial">WebGL tutorial</a>.</p>

<h2 id="Constants">Constants</h2>

<dl>
 <dt><code>ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT</code></dt>
 <dd>This is the <code>pname</code> argument to the {{domxref("WebGLRenderingContext.getParameter", "gl.getParameter()")}} call, and it returns the maximum available anisotropy.</dd>
 <dt><code>ext.TEXTURE_MAX_ANISOTROPY_EXT</code></dt>
 <dd>This is the <code>pname</code> argument to the&nbsp;{{domxref("WebGLRenderingContext.texParameter", "gl.texParameter()")}} and&nbsp;{{domxref("WebGLRenderingContext.getTexParameterf", "gl.getTexParameterf()")}}/{{domxref("WebGLRenderingContext.getTexParameteri", "gl.getTexParameteri()")}} calls and sets the desired maximum anisotropy for a texture.</dd>
</dl>

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

<pre class="brush:js">
var texture = gl.createTexture();
gl.bindTexture(gl.TEXTURE_2D, texture);
var ext = (
  gl.getExtension('EXT_texture_filter_anisotropic') ||
  gl.getExtension('MOZ_EXT_texture_filter_anisotropic') ||
  gl.getExtension('WEBKIT_EXT_texture_filter_anisotropic')
);
if (ext){
  var max = gl.getParameter(ext.MAX_TEXTURE_MAX_ANISOTROPY_EXT);
  gl.texParameterf(gl.TEXTURE_2D, ext.TEXTURE_MAX_ANISOTROPY_EXT, max);
}</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('EXT_texture_filter_anisotropic', "", "EXT_texture_filter_anisotropic")}}</td>
   <td>{{Spec2('EXT_texture_filter_anisotropic')}}</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>{{CompatUnknown}}</td>
   <td>{{CompatGeckoDesktop(17)}} [1]</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</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>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
   <td>{{CompatUnknown}}</td>
  </tr>
 </tbody>
</table>
</div>

<p>[1] This extension was prefixed as <code>MOZ_EXT_texture_filter_anisotropic</code> in prior versions.</p>

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

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