Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 22 additions & 10 deletions specs/latest/1.0/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -395,35 +395,38 @@ <h3><a name="THE_DRAWING_BUFFER">The Drawing Buffer</a></h3>
<dl class="methods">
<dt class="idl-code">undefined drawingBufferStorage(GLenum sizedFormat, unsigned long width, unsigned long height);
<dd>
<p>
Respecify the format and size of the drawing buffer,
similar to <code>renderbufferStorage</code> as used on Renderbuffers.

(However, neither <code>RGB8</code> nor <code>RGBA8</code> are valid for <code>renderbufferStorage</code> in unextended WebGL 1.0)
</p><p>
Clearing behavior is equivalent to setting <code>HTMLCanvasElement.width</code> and <code>HTMLCanvasElement.height</code>, followed by changing the drawing buffer format.
This method respects <code>WebGLContextAttributes.antialias</code>.

</p><p>
<div class="note">
<code>drawingBufferStorage</code> allows for efficiently respecifying width and height together simultaneously.
With <code>HTMLCanvasElement.width</code> and <code>HTMLCanvasElement.height</code>,
setting one and then the other can incur intermediate reallocations, though User Agents do try to optimize these out.
</div>

</p><p>
If <code>drawingBufferStorage</code> is successful, the <code>drawingBufferFormat</code> becomes <code>sizedFormat</code>.
<code>drawingBufferWidth</code> and <code>drawingBufferHeight</code> become <code>width</code> and <code>height</code> respectively.
Operations on the default framebuffer therefore behave as if operating on a non-default framebuffer with an attachment of <code>sizedFormat</code>.
E.g. after <code>drawingBufferStorage(gl.RGBA16F, 1, 1)</code>, because the framebuffer is "floatish",
readPixels's main format/type pair is <code>RGBA</code>/<code>FLOAT</code> instead of <code>RGBA</code>/<code>UNSIGNED_BYTE</code>.

</p><p>
If <code>WebGLContextAttributes.alpha</code> is <code>false</code>, generate <code>INVALID_OPERATION</code>.

<code>RGBA8</code> is always supported for <code>sizedFormat</code>.
</p><p>
<code>RGB8</code> and <code>RGBA8</code> are always supported for <code>sizedFormat</code>.
</p><p>
Additionally, the following enums are supported if they are currently valid for <code>renderbufferStorage</code>:
<ul>
<li><code>RGBA8</code>
<li><code>SRGB8_ALPHA8</code> (<code>0x8C43</code>) (E.g. from EXT_sRGB)
<li><code>RGBA16F</code> (<code>0x881A</code>) (E.g. from EXT_color_buffer_half_float)
</ul>
</p><p>
If <code>sizedFormat</code> is not currently supported, generate <code>INVALID_ENUM</code>.

</p><p>
<div class="note">
<p>
In WebGL 1.0, <code>SRGB8_ALPHA8</code> requires the extension <code>EXT_sRGB</code>.
Expand All @@ -434,11 +437,12 @@ <h3><a name="THE_DRAWING_BUFFER">The Drawing Buffer</a></h3>
In WebGL 2.0, <code>RGBA16F</code> requires the extension <code>EXT_color_buffer_float</code>.
</p>
</div>

</p><p>
If <code>width</code> or <code>height</code> are greater than the limit <code>MAX_RENDERBUFFER_SIZE</code>,
generate <code>INVALID_VALUE</code>.

</p><p>
If allocation fails, generate <code>OUT_OF_MEMORY</code>.
</p>
</dl>

<!-- ======================================================================================================= -->
Expand Down Expand Up @@ -1743,6 +1747,7 @@ <h3><a name="WEBGLRENDERINGCONTEXT">The WebGL context</a></h3>

const GLenum RGBA4 = 0x8056;
const GLenum RGB5_A1 = 0x8057;
const GLenum RGB8 = 0x8051;
const GLenum RGBA8 = 0x8058;
const GLenum RGB565 = 0x8D62;
const GLenum DEPTH_COMPONENT16 = 0x81A5;
Expand Down Expand Up @@ -2777,6 +2782,13 @@ <h4>Texture objects</h4>
<dd>
Uploads the given element or image data to the currently bound WebGLTexture. <br><br>

<div class="note">
Sized internal formats are invalid for texture specification in WebGL 1.0.
Therefore even though <code>drawingbufferStorage</code> uses <code>RGBA8</code>,
<code>texImage2D</code> must use <code>RGBA</code> instead.
(Same with <code>RGB8</code> and <code>RGB</code>)
</div>

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>

Expand Down
1 change: 1 addition & 0 deletions specs/latest/1.0/webgl.idl
Original file line number Diff line number Diff line change
Expand Up @@ -490,6 +490,7 @@ interface mixin WebGLRenderingContextBase

const GLenum RGBA4 = 0x8056;
const GLenum RGB5_A1 = 0x8057;
const GLenum RGB8 = 0x8051;
const GLenum RGBA8 = 0x8058;
const GLenum RGB565 = 0x8D62;
const GLenum DEPTH_COMPONENT16 = 0x81A5;
Expand Down