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 995081 of WebGLTexture

  • Revision slug: Web/API/WebGLTexture
  • Revision title: WebGLTexture
  • Revision id: 995081
  • Created:
  • Creator: fscholz
  • Is current revision? Yes
  • Comment Available to workers behind a pref (bug 709490)
Tags: 

Revision Content

{{APIRef("WebGL")}}

The WebGLTexture interface is part of the WebGL API and represents an opaque texture object providing storage and state for texturing operations.

Description

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

  • {{domxref("WebGLRenderingContext.bindTexture()")}}
  • {{domxref("WebGLRenderingContext.createTexture()")}}
  • {{domxref("WebGLRenderingContext.deleteTexture()")}}
  • {{domxref("WebGLRenderingContext.isTexture()")}}

Examples

Creating a texture

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

Specifications

Specification Status Comment
{{SpecName('WebGL', "#5.9", "WebGLTexture")}} {{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.bindTexture()")}}
  • {{domxref("WebGLRenderingContext.createTexture()")}}
  • {{domxref("WebGLRenderingContext.deleteTexture()")}}
  • {{domxref("WebGLRenderingContext.isTexture()")}}
  • {{domxref("WebGLRenderingContext.compressedTexImage2D()")}}
  • {{domxref("WebGLRenderingContext.compressedTexSubImage2D()")}}
  • {{domxref("WebGLRenderingContext.copyTexImage2D()")}}
  • {{domxref("WebGLRenderingContext.copyTexSubImage2D()")}}
  • {{domxref("WebGLRenderingContext.generateMipmap()")}}
  • {{domxref("WebGLRenderingContext.getTexParameter()")}}
  • {{domxref("WebGLRenderingContext.texImage2D()")}}
  • {{domxref("WebGLRenderingContext.texSubImage2D()")}}
  • {{domxref("WebGLRenderingContext.texParameterf()")}}
  • {{domxref("WebGLRenderingContext.texParameteri()")}}

Revision Source

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

<p>The <strong>WebGLTexture</strong> interface is part of the <a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> and represents an opaque texture object providing storage and state for texturing operations.</p>

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

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

<ul>
 <li>{{domxref("WebGLRenderingContext.bindTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.createTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.deleteTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.isTexture()")}}</li>
</ul>

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

<h3 id="Creating_a_texture">Creating a texture</h3>

<pre class="brush: js">
var canvas = document.getElementById("canvas");
var gl = canvas.getContext("webgl");
var texture = gl.createTexture();
</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.9", "WebGLTexture")}}</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.bindTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.createTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.deleteTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.isTexture()")}}</li>
 <li>{{domxref("WebGLRenderingContext.compressedTexImage2D()")}}</li>
 <li>{{domxref("WebGLRenderingContext.compressedTexSubImage2D()")}}</li>
 <li>{{domxref("WebGLRenderingContext.copyTexImage2D()")}}</li>
 <li>{{domxref("WebGLRenderingContext.copyTexSubImage2D()")}}</li>
 <li>{{domxref("WebGLRenderingContext.generateMipmap()")}}</li>
 <li>{{domxref("WebGLRenderingContext.getTexParameter()")}}</li>
 <li>{{domxref("WebGLRenderingContext.texImage2D()")}}</li>
 <li>{{domxref("WebGLRenderingContext.texSubImage2D()")}}</li>
 <li>{{domxref("WebGLRenderingContext.texParameterf()")}}</li>
 <li>{{domxref("WebGLRenderingContext.texParameteri()")}}</li>
</ul>
Revert to this revision