<!--end-logo-->
<h1>WebGL Specification</h1>
- <h2 class="no-toc">Editor's Draft 25 November 2013</h2>
+ <h2 class="no-toc">Editor's Draft 17 April 2014</h2>
<dl>
<dt>This version:
<dd>
</dd>
</dl>
- <span style="font-size: x-small; font-style: oblique">Copyright © 2013 Khronos Group</span>
+ <span style="font-size: x-small; font-style: oblique">Copyright © 2014 Khronos Group</span>
<hr />
const GLenum VERTEX_ATTRIB_ARRAY_POINTER = 0x8645;
const GLenum VERTEX_ATTRIB_ARRAY_BUFFER_BINDING = 0x889F;
+ /* Read Format */
+ const GLenum IMPLEMENTATION_COLOR_READ_TYPE = 0x8B9A;
+ const GLenum IMPLEMENTATION_COLOR_READ_FORMAT = 0x8B9B;
+
/* Shader Source */
const GLenum COMPILE_STATUS = 0x8B81;
<tr><td>FRONT_FACE</td><td>GLenum</td></tr>
<tr><td>GENERATE_MIPMAP_HINT</td><td>GLenum</td></tr>
<tr><td>GREEN_BITS</td><td>GLint</td></tr>
+ <tr><td>IMPLEMENTATION_COLOR_READ_FORMAT</td><td>GLenum</td></tr>
+ <tr><td>IMPLEMENTATION_COLOR_READ_TYPE</td><td>GLenum</td></tr>
<tr><td>LINE_WIDTH</td><td>GLfloat</td></tr>
<tr><td>MAX_COMBINED_TEXTURE_IMAGE_UNITS</td><td>GLint</td></tr>
<tr><td>MAX_CUBE_MAP_TEXTURE_SIZE</td><td>GLint</td></tr>
<dd>
Uploads the given element or image data to the currently bound WebGLTexture. <br><br>
+ The width and height of the texture are set as specified in section
+ <a href="#TEXTURE_UPLOAD_SIZE">Texture Upload Width and Height</a>.<br><br>
+
The source image data is conceptually first converted to the data type and format
specified by the <em>format</em> and <em>type</em> arguments, and then transferred to
the WebGL implementation. If a packed pixel format is specified which would imply loss
Updates a sub-rectangle of the currently bound WebGLTexture with the contents of the
given element or image data. <br><br>
+ The width and height of the updated sub-rectangle are determined as specified in section
+ <a href="#TEXTURE_UPLOAD_SIZE">Texture Upload Width and Height</a>.<br><br>
+
See <a href="#TEXIMAGE2D_HTML">texImage2D</a> for the interpretation of
the <em>format</em> and <em>type</em> arguments, and notes on
the <code>UNPACK_PREMULTIPLY_ALPHA_WEBGL</code> pixel storage parameter. <br><br>
See <a href="#PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a> for WebGL-specific
pixel storage parameters that affect the behavior of this function.
</dl>
-
+
<!-- ======================================================================================================= -->
<h4>Programs and Shaders</h4>
<span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-2.8">OpenGL ES 2.0 §2.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glDrawArrays.xml">man page</a>)</span>
<dd>
If <em>first</em> is negative, an <code>INVALID_VALUE</code> error will be generated.
+ If the CURRENT_PROGRAM is null, an <code>INVALID_OPERATION</code> error will be generated.
<dt class="idl-code">void drawElements(GLenum mode, GLsizei count, GLenum type, GLintptr offset)
<span class="gl-spec">(<a href="http://www.khronos.org/registry/gles/specs/2.0/es_full_spec_2.0.25.pdf#nameddest=section-2.8">OpenGL ES 2.0 §2.8</a>, <a class="nonnormative" href="http://www.khronos.org/opengles/sdk/2.0/docs/man/xhtml/glDrawElements.xml">man page</a>)</span>
<dd>
Requirements</a>. If <code>count</code> is greater than zero, then a non-null
<code>WebGLBuffer</code> must be bound to the <code>ELEMENT_ARRAY_BUFFER</code> binding
point or an <code>INVALID_OPERATION</code> error will be generated.<br><br>
+ If the CURRENT_PROGRAM is null, an <code>INVALID_OPERATION</code> error will be generated.
WebGL performs additional error checking beyond that specified in OpenGL ES 2.0 during
calls to <code>drawArrays</code>
the types do not match, an INVALID_OPERATION error is generated.
<br><br>
- The following are the allowed format and type combinations:
-
- <table class="foo">
- <tr><th>format</th><th>type</th></tr>
- <tr><td>RGBA</td><td>UNSIGNED_BYTE</td></tr>
- </table>
+ Only two combinations of <code>format</code> and <code>type</code> are accepted. The
+ first is <code>format</code> RGBA and <code>type</code> UNSIGNED_BYTE. The second is an
+ implementation-chosen format. The values of <code>format</code> and <code>type</code>
+ for this format may be determined by calling
+ <a href="#GETPARAMETER"><code>getParameter</code></a> with the symbolic constants
+ IMPLEMENTATION_COLOR_READ_FORMAT and IMPLEMENTATION_COLOR_READ_TYPE, respectively. The
+ implementation-chosen format may vary depending on the format of the currently bound
+ rendering surface. Unsupported combinations of <code>format</code> and <code>type</code>
+ will generate an INVALID_OPERATION error. <br><br>
If <code>pixels</code> is null, an INVALID_VALUE error is generated. If
<code>pixels</code> is non-null, but is not large enough to retrieve all of the pixels
<li> If the
event's <a href="http://dvcs.w3.org/hg/domcore/raw-file/tip/Overview.html#canceled-flag">canceled
- flag</a> is not set, abort these steps. </li>
+ flag</a> is set, abort these steps. </li>
<li> Perform the following steps asynchronously. </li>
</p>
- <h3>Framebuffer Object Attachments</h3>
+ <h3><a name="FBO_ATTACHMENTS">Framebuffer Object Attachments</a></h3>
<p>
<li> <code>COLOR_ATTACHMENT0</code> = <code>RGBA/UNSIGNED_BYTE</code> texture + <code>DEPTH_STENCIL_ATTACHMENT</code> = <code>DEPTH_STENCIL</code> renderbuffer
</ul>
+<h3><a name="TEXTURE_UPLOAD_SIZE">Texture Upload Width and Height</a></h3>
+
+<p>
+Unless <code>width</code> and <code>height</code> parameters are explicitly specified, the width
+and height of the texture set by <code>texImage2D</code> and the width and height of the
+sub-rectangle updated by <code>texSubImage2D</code> are determined based on the uploaded element or
+image data the following way:
+</p>
+
+ <dl>
+ <dt><code>ImageData pixels</code>
+ <dd>
+ The width and height of the texture are set to the current values of the width and
+ height properties of <code>pixels</code>, representing the actual pixel width and height
+ of <code>pixels</code>.
+ <dt><code>HTMLImageElement image</code>
+ <dd>
+ If a bitmap is uploaded, the width and height of the texture are set to the width and
+ height of the uploaded bitmap in pixels. If an SVG image is uploaded, the width and
+ height of the texture are set to the current values of the width and height properties
+ of <code>image</code>.
+ <dt><code>HTMLCanvasElement canvas</code>
+ <dd>
+ The width and height of the texture are set to the current values of the width and
+ height properties of <code>canvas</code>.
+ <dt><code>HTMLVideoElement video</code>
+ <dd>
+ The width and height of the texture are set to the width and height of the uploaded
+ frame of the video in pixels.
+ </dl>
+
<h3><a name="PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a></h3>
<p>
</p>
- <h3><a name="IMPLEMENTATION_READ_FORMAT">Implementation Color Read Format and Type</a></h3>
-
-<p>
-
- In the OpenGL ES 2.0 API, the
- <code>IMPLEMENTATION_COLOR_READ_FORMAT</code> and
- <code>IMPLEMENTATION_COLOR_READ_TYPE</code> parameters are used to inform applications of an
- additional format and type combination that may be passed to <code>ReadPixels</code>, in
- addition to the required <ncode>RGBA</code>/<code>UNSIGNED_BYTE</code> pair. In WebGL 1.0,
- the supported format and type combinations to <code>ReadPixels</code> are documented in the
- <a href="#readpixels">Reading back pixels</a> section. The <code>IMPLEMENTATION_COLOR_READ_FORMAT</code>
- and <code>IMPLEMENTATION_COLOR_READ_TYPE</code> enumerants have been removed.
-</p>
-
<h3><a name="COMPRESSED_TEXTURE_SUPPORT">Compressed Texture Support</a></h3>
<p>
<p>This specification is produced by the Khronos WebGL Working Group.</p>
<p>
- Special thanks to: Arun Ranganathan (Mozilla), Chris Marrin (Apple), Jon Leech, Kenneth
- Russell (Google), Kenneth Waters (Google), Mark Callow (HI), Mark Steele (Mozilla), Oliver
- Hunt (Apple), Tim Johansson (Opera), Vangelis Kokkevis (Google), Vladimir Vukicevic
- (Mozilla), Gregg Tavares (Google)
+ Special thanks to: Arun Ranganathan (Mozilla), Chris Marrin (Apple), Jon Leech, Kenneth
+ Russell (Google), Kenneth Waters (Google), Mark Callow (HI), Mark Steele (Mozilla), Oliver
+ Hunt (Apple), Tim Johansson (Opera), Vangelis Kokkevis (Google), Vladimir Vukicevic
+ (Mozilla), Gregg Tavares (Google)
</p>
<p>
- Additional thanks to: Alan Hudson (Yumetech), Bill Licea Kane (AMD), Boris Zbarsky
- (Mozilla), Cameron McCormack (Mozilla), Cedric Vivier (Zegami), Dan Gessel (Apple), David
- Ligon (Qualcomm), David Sheets (Ashima Arts), Glenn Maynard, Greg Roth (Nvidia), Jacob Strom
- (Ericsson), Kari Pulli (Nokia), Teddie Stenvi (ST-Ericsson), Neil Trevett (Nvidia), Per
- Wennersten (Ericsson), Per-Erik Brodin (Ericsson), Shiki Okasaka (Google), Tom Olson (ARM),
- Zhengrong Yao (Ericsson), and the members of the Khronos WebGL Working Group.
-</p>
+ Additional thanks to: Alan Hudson (Yumetech), Benoit Jacob (Mozilla), Bill Licea Kane (AMD),
+ Boris Zbarsky (Mozilla), Cameron McCormack (Mozilla), Cedric Vivier (Zegami), Dan Gessel
+ (Apple), David Ligon (Qualcomm), David Sheets (Ashima Arts), Glenn Maynard, Greg Roth
+ (Nvidia), Jacob Strom (Ericsson), Jeff Gilbert (Mozilla), Kari Pulli (Nokia), Teddie Stenvi
+ (ST-Ericsson), Neil Trevett (Nvidia), Per Wennersten (Ericsson), Per-Erik Brodin (Ericsson),
+ Shiki Okasaka (Google), Tom Olson (ARM), Zhengrong Yao (Ericsson), and the members of the
+ Khronos WebGL Working Group.
+ </p>
</body>
</html>