Skip to content

Commit 2ace8df

Browse files
lexaknyazevkdashg
authored andcommitted
Specify DOM image conversion (#2805)
* Specify DOM image conversion * Address feedback
1 parent 4c80306 commit 2ace8df

2 files changed

Lines changed: 75 additions & 2 deletions

File tree

specs/latest/1.0/index.html

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2602,8 +2602,55 @@ <h4>Texture objects</h4>
26022602

26032603
The source image data is conceptually first converted to the data type and format
26042604
specified by the <em>format</em> and <em>type</em> arguments, and then transferred to
2605-
the WebGL implementation. If a packed pixel format is specified which would imply loss
2606-
of bits of precision from the image data, this loss of precision must occur. <br><br>
2605+
the WebGL implementation. Format conversion is performed according to the following table.
2606+
If a packed pixel format is specified which would imply loss of bits of precision from the
2607+
image data, this loss of precision must occur. <br><br>
2608+
2609+
<table class="foo">
2610+
<tr>
2611+
<th rowspan="2">Source DOM Image Format</th>
2612+
<th colspan="5">Target WebGL Format</th>
2613+
</tr>
2614+
<tr>
2615+
<th>ALPHA</th>
2616+
<th>RGB</th>
2617+
<th>RGBA</th>
2618+
<th>LUMINANCE</th>
2619+
<th>LUMINANCE_ALPHA</th>
2620+
</tr>
2621+
<tr>
2622+
<td>Grayscale (1 channel)</td>
2623+
<td>A = 255 (1.0)</td>
2624+
<td>R = <em>sourceGray</em><br>G = <em>sourceGray</em><br>B = <em>sourceGray</em><br></td>
2625+
<td>R = <em>sourceGray</em><br>G = <em>sourceGray</em><br>B = <em>sourceGray</em><br>A = 255 (1.0)</td>
2626+
<td>L = <em>sourceGray</em></td>
2627+
<td>L = <em>sourceGray</em><br>A = 255 (1.0)</td>
2628+
</tr>
2629+
<tr>
2630+
<td>Grayscale + Alpha (2 channels)</td>
2631+
<td>A = <em>sourceAlpha</em></td>
2632+
<td>R = <em>sourceGray</em><br>G = <em>sourceGray</em><br>B = <em>sourceGray</em><br></td>
2633+
<td>R = <em>sourceGray</em><br>G = <em>sourceGray</em><br>B = <em>sourceGray</em><br>A = <em>sourceAlpha</em></td>
2634+
<td>L = <em>sourceGray</em><br></td>
2635+
<td>L = <em>sourceGray</em><br>A = <em>sourceAlpha</em></td>
2636+
</tr>
2637+
<tr>
2638+
<td>Color (3 channels)</td>
2639+
<td>A = 255 (1.0)</td>
2640+
<td>R = <em>sourceRed</em><br>G = <em>sourceGreen</em><br>B = <em>sourceBlue</em><br></td>
2641+
<td>R = <em>sourceRed</em><br>G = <em>sourceGreen</em><br>B = <em>sourceBlue</em><br>A = 255 (1.0)<br></td>
2642+
<td>L = <em>sourceRed</em></td>
2643+
<td>L = <em>sourceRed</em><br>A = 255 (1.0)</td>
2644+
</tr>
2645+
<tr>
2646+
<td>Color + Alpha (4 channels)</td>
2647+
<td>A = <em>sourceAlpha</em></td>
2648+
<td>R = <em>sourceRed</em><br>G = <em>sourceGreen</em><br>B = <em>sourceBlue</em></td>
2649+
<td>R = <em>sourceRed</em><br>G = <em>sourceGreen</em><br>B = <em>sourceBlue</em><br>A = <em>sourceAlpha</em></td>
2650+
<td>L = <em>sourceRed</em></td>
2651+
<td>L = <em>sourceRed</em><br>A = <em>sourceAlpha</em></td>
2652+
</tr>
2653+
</table><br>
26072654

26082655
See <a href="#PIXEL_STORAGE_PARAMETERS">Pixel Storage Parameters</a> for WebGL-specific
26092656
pixel storage parameters that affect the behavior of this function when it is called

specs/latest/2.0/index.html

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1695,6 +1695,32 @@ <h4>Texture objects</h4>
16951695
</dt>
16961696
<dd>
16971697
<p>Only differences from <a href="../1.0/index.html#TEXIMAGE2D_HTML">texImage2D</a> in WebGL 1.0 are described here. </p>
1698+
<p>Conversion to new formats introduced in WebGL 2.0 is performed according to the following table.</p>
1699+
<table class="foo">
1700+
<tr>
1701+
<th rowspan="2">Source DOM Image Format</th>
1702+
<th colspan="2">Target WebGL Format</th>
1703+
</tr>
1704+
<tr>
1705+
<th>RED</th>
1706+
<th>RG</th>
1707+
</tr>
1708+
<tr>
1709+
<td>Grayscale (1 channel)</td>
1710+
<td>R = <em>sourceGray</em><br></td>
1711+
<td>R = <em>sourceGray</em><br>G = 0</td>
1712+
</tr>
1713+
<tr>
1714+
<td>Grayscale + Alpha (2 channels)</td>
1715+
<td>R = <em>sourceGray</em><br></td>
1716+
<td>R = <em>sourceGray</em><br>G = <em>sourceAlpha</em></td>
1717+
</tr>
1718+
<tr>
1719+
<td>Color (3 channels)<br>Color + Alpha (4 channels)</td>
1720+
<td>R = <em>sourceRed</em><br></td>
1721+
<td>R = <em>sourceRed</em><br>G = <em>sourceGreen</em><br></td>
1722+
</tr>
1723+
</table><br>
16981724
<p>Uploading subregions of elements is detailed in <a href="#DOM_UPLOAD_UNPACK_PARAMS">Pixel
16991725
store parameters for uploads from <code>TexImageSource</code></a>.
17001726
<p>If a WebGLBuffer is bound to the <code>PIXEL_UNPACK_BUFFER</code> target, generates an <code>INVALID_OPERATION</code> error.</p>

0 commit comments

Comments
 (0)