Skip to content

Commit

Permalink
Integrate with WebGL 2.0 ("webgl2" context)
Browse files Browse the repository at this point in the history
  • Loading branch information
kenrussell authored and annevk committed Aug 30, 2018
1 parent ae688ea commit 3a20936
Showing 1 changed file with 57 additions and 41 deletions.
98 changes: 57 additions & 41 deletions source
Original file line number Diff line number Diff line change
Expand Up @@ -3867,10 +3867,11 @@ a.setAttribute('href', 'https://example.com/'); // change the content attribute

<dd>

<p>The following interface is defined in the WebGL specification: <ref spec=WEBGL></p>
<p>The following interfaces are defined in the WebGL specifications: <ref spec=WEBGL></p>

<ul class="brief">
<li><dfn data-x-href="https://www.khronos.org/registry/webgl/specs/latest/1.0/#WebGLRenderingContext"><code>WebGLRenderingContext</code></dfn> interface</li>
<li><dfn data-x-href="https://www.khronos.org/registry/webgl/specs/latest/2.0/#WebGL2RenderingContext"><code>WebGL2RenderingContext</code></dfn> interface</li>
</ul>

</dd>
Expand Down Expand Up @@ -59301,7 +59302,7 @@ dictionary <dfn>AssignedNodesOptions</dfn> {
<dd><code data-x="attr-canvas-height">height</code></dd>
<dt><span data-x="concept-element-dom">DOM interface</span>:</dt>
<dd w-nodev>
<pre><code class="idl" data-x="">typedef (<span>CanvasRenderingContext2D</span> or <span>ImageBitmapRenderingContext</span> or <span>WebGLRenderingContext</span>) <dfn>RenderingContext</dfn>;
<pre><code class="idl" data-x="">typedef (<span>CanvasRenderingContext2D</span> or <span>ImageBitmapRenderingContext</span> or <span>WebGLRenderingContext</span> or <span>WebGL2RenderingContext</span>) <dfn>RenderingContext</dfn>;

[Exposed=Window,
<span>HTMLConstructor</span>]
Expand Down Expand Up @@ -59417,8 +59418,9 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
data-x="concept-canvas-none">none</dfn> but can be changed to either <dfn
data-x="concept-canvas-placeholder">placeholder</dfn>, <dfn
data-x="concept-canvas-2d">2d</dfn>, <dfn
data-x="concept-canvas-bitmaprenderer">bitmaprenderer</dfn>, or <dfn
data-x="concept-canvas-webgl">webgl</dfn> by algorithms defined in this specification.</p>
data-x="concept-canvas-bitmaprenderer">bitmaprenderer</dfn>, <dfn
data-x="concept-canvas-webgl">webgl</dfn>, or <dfn
data-x="concept-canvas-webgl2">webgl2</dfn> by algorithms defined in this specification.</p>

<p>When its <span data-x="concept-canvas-context-mode">canvas context mode</span> is <span
data-x="concept-canvas-none">none</span>, a <code>canvas</code> element has no rendering context,
Expand Down Expand Up @@ -59467,9 +59469,10 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>

<tr>
<th>
<p><span data-x="concept-canvas-webgl">webgl</span></p>
<p><span data-x="concept-canvas-webgl">webgl</span> or <span
data-x="concept-canvas-webgl2">webgl2</span></p>
<td>
<p>Follow the behavior defined in the WebGL specification. <ref spec=WEBGL></p>
<p>Follow the behavior defined in the WebGL specifications. <ref spec=WEBGL></p>

<tr>
<th>
Expand Down Expand Up @@ -59505,13 +59508,14 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
<dd>
<p>Returns an object that exposes an API for drawing on the canvas. <var>contextId</var>
specifies the desired API: "<code data-x="canvas-context-2d">2d</code>", "<code
data-x="canvas-context-bitmaprenderer">bitmaprenderer</code>", or "<code
data-x="canvas-context-webgl">webgl</code>". <var>options</var> is handled by that API.</p>
data-x="canvas-context-bitmaprenderer">bitmaprenderer</code>", "<code
data-x="canvas-context-webgl">webgl</code>", or "<code
data-x="canvas-context-webgl2">webgl2</code>". <var>options</var> is handled by that API.</p>

<p>This specification defines the "<code data-x="canvas-context-2d">2d</code>" and "<code
data-x="canvas-context-bitmaprenderer">bitmaprenderer</code>" contexts below. There is also a
specification that defines a "<code data-x="canvas-context-webgl">webgl</code>" context. <ref
spec=WEBGL></p>
data-x="canvas-context-bitmaprenderer">bitmaprenderer</code>" contexts below. The WebGL
specifications define the "<code data-x="canvas-context-webgl">webgl</code>" and "<code
data-x="canvas-context-webgl2">webgl2</code>" contexts. <ref spec=WEBGL></p>

<p>Returns null if <var>contextId</var> is not supported, or if the canvas has already been
initialized with another context type (e.g., trying to get a "<code
Expand Down Expand Up @@ -59545,7 +59549,8 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
<th><span data-x="concept-canvas-none">none</span>
<th><span data-x="concept-canvas-2d">2d</span>
<th><span data-x="concept-canvas-bitmaprenderer">bitmaprenderer</span>
<th><span data-x="concept-canvas-webgl">webgl</span>
<th><span data-x="concept-canvas-webgl">webgl</span> or <span
data-x="concept-canvas-webgl2">webgl2</span>
<th><span data-x="concept-canvas-placeholder">placeholder</span>
<tbody>
<tr>
Expand Down Expand Up @@ -59585,15 +59590,18 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
<td>
Throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.
<tr>
<th>"<dfn><code data-x="canvas-context-webgl">webgl</code></dfn>", if the user agent supports
the WebGL feature in its current configuration
<th>"<dfn><code data-x="canvas-context-webgl">webgl</code></dfn>" or "<dfn><code
data-x="canvas-context-webgl2">webgl2</code></dfn>", if the user agent supports the WebGL
feature in its current configuration
<td>
Follow the instructions given in the WebGL specification's <i>Context Creation</i> section
to obtain either a <code>WebGLRenderingContext</code> or null; if the returned value is
null, then return null; otherwise, set this <code>canvas</code> element's <span
data-x="concept-canvas-context-mode">context mode</span> to <span
data-x="concept-canvas-webgl">webgl</span>, and return the
<code>WebGLRenderingContext</code> object. <ref spec=WEBGL>
Follow the instructions given in the WebGL specifications' <i>Context Creation</i> sections
to obtain a <code>WebGLRenderingContext</code>, <code>WebGL2RenderingContext</code>, or
null; if the returned value is null, then return null; otherwise, set this
<code>canvas</code> element's <span data-x="concept-canvas-context-mode">context mode</span>
to <span data-x="concept-canvas-webgl">webgl</span> or <span
data-x="concept-canvas-webgl2">webgl2</span>, and return the
<code>WebGLRenderingContext</code> or <code>WebGL2RenderingContext</code> object. <ref
spec=WEBGL>
<td>
Return null.
<td>
Expand All @@ -59618,7 +59626,8 @@ callback <dfn>BlobCallback</dfn> = void (<span>Blob</span>? blob);</code></pre>
</table>

<p class="tablenote"><small>* For example, the "<code
data-x="canvas-context-webgl">webgl</code>" value in the case of a user agent having exhausted
data-x="canvas-context-webgl">webgl</code>" or "<code
data-x="canvas-context-webgl2">webgl2</code>" value in the case of a user agent having exhausted
the graphics hardware's abilities and having no software fallback implementation.</small></p>
</li>
</ol>
Expand Down Expand Up @@ -65023,15 +65032,14 @@ dictionary <dfn>ImageBitmapRenderingContextSettings</dfn> {

<h5>The <code>OffscreenCanvas</code> interface</h5>

<pre><code class="idl" data-x="">typedef (<span>OffscreenCanvasRenderingContext2D</span> or
<span>WebGLRenderingContext</span>) <dfn>OffscreenRenderingContext</dfn>;
<pre><code class="idl" data-x="">typedef (<span>OffscreenCanvasRenderingContext2D</span> or <span>WebGLRenderingContext</span> or <span>WebGL2RenderingContext</span>) <dfn>OffscreenRenderingContext</dfn>;

dictionary <dfn>ImageEncodeOptions</dfn> {
DOMString <span data-x="image-encode-options-type">type</span> = "image/png";
unrestricted double <span data-x="image-encode-options-quality">quality</span> = 1.0;
};

enum <dfn>OffscreenRenderingContextId</dfn> { "<span data-x="offscreen-context-type-2d">2d</span>", "<span data-x="offscreen-context-type-webgl">webgl</span>" };
enum <dfn>OffscreenRenderingContextId</dfn> { "<span data-x="offscreen-context-type-2d">2d</span>", "<span data-x="offscreen-context-type-webgl">webgl</span>", "<span data-x="offscreen-context-type-webgl2">webgl2</span>" };

[<span data-x="dom-OffscreenCanvas">Constructor</span>([EnforceRange] unsigned long long width, [EnforceRange] unsigned long long height), Exposed=(Window,Worker), <span>Transferable</span>]
interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
Expand Down Expand Up @@ -65081,15 +65089,16 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
<dd>
<p>Returns an object that exposes an API for drawing on the <code>OffscreenCanvas</code>
object. <var>contextId</var> specifies the desired API: "<code
data-x="offscreen-context-type-2d">2d</code>" or "<code
data-x="offscreen-context-type-webgl">webgl</code>". <var>options</var> is handled by that
data-x="offscreen-context-type-2d">2d</code>", "<code
data-x="offscreen-context-type-webgl">webgl</code>", or "<code
data-x="offscreen-context-type-webgl2">webgl2</code>". <var>options</var> is handled by that
API.</p>

<p>This specification defines the "<code data-x="canvas-context-2d">2d</code>" context below,
which is similar but distinct from the "<code data-x="offscreen-context-type-2d">2d</code>"
context that is created from a <code>canvas</code> element. There is also a specification that
defines a "<code data-x="offscreen-context-type-webgl">webgl</code>" context. <ref
spec=WEBGL></p>
context that is created from a <code>canvas</code> element. The WebGL specifications define the
"<code data-x="offscreen-context-type-webgl">webgl</code>" and "<code
data-x="offscreen-context-type-webgl2">webgl2</code>" contexts. <ref spec=WEBGL></p>

<p>Returns null if the canvas has already been initialized with another context type (e.g.,
trying to get a "<code data-x="offscreen-context-type-2d">2d</code>" context after getting a
Expand All @@ -65112,7 +65121,8 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
has a <dfn data-x="offscreencanvas-context-mode">context mode</dfn>, which is initially <dfn
data-x="offscreencanvas-context-none">none</dfn> but can be changed to either <dfn
data-x="offscreencanvas-context-2d">2d</dfn>, <dfn
data-x="offscreencanvas-context-webgl">webgl</dfn> or <dfn
data-x="offscreencanvas-context-webgl">webgl</dfn>, <dfn
data-x="offscreencanvas-context-webgl2">webgl2</dfn>, or <dfn
data-x="offscreencanvas-context-detached">detached</dfn> by algorithms defined in this
specification.</p>

Expand Down Expand Up @@ -65189,7 +65199,8 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
<td>
<th><span data-x="offscreencanvas-context-none">none</span>
<th><span data-x="offscreencanvas-context-2d">2d</span>
<th><span data-x="offscreencanvas-context-webgl">webgl</span>
<th><span data-x="offscreencanvas-context-webgl">webgl</span> or <span
data-x="offscreencanvas-context-webgl2">webgl2</span>
<th><span data-x="offscreencanvas-context-detached">detached</span>
<tbody>
<tr>
Expand All @@ -65211,14 +65222,17 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
<td>
Throw an <span>"<code>InvalidStateError</code>"</span> <code>DOMException</code>.
<tr>
<th>"<dfn><code data-x="offscreen-context-type-webgl">webgl</code></dfn>"
<th>"<dfn><code data-x="offscreen-context-type-webgl">webgl</code></dfn>" or "<dfn><code
data-x="offscreen-context-type-webgl2">webgl2</code></dfn>"
<td>
Follow the instructions given in the WebGL specification's <i>Context Creation</i> section
to obtain either a <code>WebGLRenderingContext</code> or null; if the returned value is
null, then return null; otherwise, set this <code>OffscreenCanvas</code> object's <span
data-x="offscreencanvas-context-mode">context mode</span> to <span
data-x="offscreencanvas-context-webgl">webgl</span>, and return the
<code>WebGLRenderingContext</code> object. <ref spec=WEBGL>
Follow the instructions given in the WebGL specifications' <i>Context Creation</i> sections
to obtain either a <code>WebGLRenderingContext</code>, <code>WebGL2RenderingContext</code>,
or null; if the returned value is null, then return null; otherwise, set this
<code>OffscreenCanvas</code> object's <span data-x="offscreencanvas-context-mode">context
mode</span> to <span data-x="offscreencanvas-context-webgl">webgl</span> or <span
data-x="offscreencanvas-context-webgl2">webgl2</span>, and return the
<code>WebGLRenderingContext</code> or <code>WebGL2RenderingContext</code> object. <ref
spec=WEBGL>
<td>
Return null.
<td>
Expand Down Expand Up @@ -65264,8 +65278,9 @@ interface <dfn>OffscreenCanvas</dfn> : <span>EventTarget</span> {
data-x="dom-OffscreenCanvas-width">width</code> and <code
data-x="dom-OffscreenCanvas-height">height</code> attributes.</p>

<p>The resizing behavior for "<code data-x="offscreen-context-type-webgl">webgl</code>"
contexts is defined in the WebGL specification. <ref spec=WEBGL></p>
<p>The resizing behavior for "<code data-x="offscreen-context-type-webgl">webgl</code>" and "<code
data-x="offscreen-context-type-webgl2">webgl2</code>" contexts is defined in the WebGL
specifications. <ref spec=WEBGL></p>

</div>

Expand Down Expand Up @@ -120955,7 +120970,7 @@ INSERT INTERFACES HERE
<dd>(Non-normative) <cite><a href="https://w3c.github.io/webcrypto/Overview.html">Web Cryptography API</a></cite>, M. Watson. W3C.</dd>

<dt id="refsWEBGL">[WEBGL]</dt>
<dd><cite><a href="https://www.khronos.org/registry/webgl/specs/latest/">WebGL Specification</a></cite>, D. Jackson. Khronos Group.</dd>
<dd><cite><a href="https://www.khronos.org/registry/webgl/specs/latest/">WebGL Specifications</a></cite>, D. Jackson, J. Gilbert. Khronos Group.</dd>

<dt id="refsWEBIDL">[WEBIDL]</dt>
<dd><cite><a href="https://heycam.github.io/webidl/">Web IDL</a></cite>, C. McCormack. W3C.</dd>
Expand Down Expand Up @@ -121547,6 +121562,7 @@ INSERT INTERFACES HERE
Keith Yeung,
Kelly Ford,
Kelly Norton,
Ken Russell,
Kenji Baheux,
Kevin Benson,
Kevin Cole,
Expand Down

0 comments on commit 3a20936

Please sign in to comment.