From f30c253b7356e853c6c65b897c62dd84ee369ac5 Mon Sep 17 00:00:00 2001
From: Kelsey Gilbert
Respecify the format and size of the drawing buffer,
similar to
Clearing behavior is equivalent to setting
The Drawing Buffer
renderbufferStorage as used on Renderbuffers.
-
+ (However, neither RGB8 nor RGBA8 are valid for renderbufferStorage in unextended WebGL 1.0)
+ HTMLCanvasElement.width and HTMLCanvasElement.height, followed by changing the drawing buffer format.
This method respects WebGLContextAttributes.antialias.
-
+ drawingBufferStorage allows for efficiently respecifying width and height together simultaneously.
With HTMLCanvasElement.width and HTMLCanvasElement.height,
setting one and then the other can incur intermediate reallocations, though User Agents do try to optimize these out.
If drawingBufferStorage is successful, the drawingBufferFormat becomes sizedFormat.
drawingBufferWidth and drawingBufferHeight become width and height respectively.
Operations on the default framebuffer therefore behave as if operating on a non-default framebuffer with an attachment of sizedFormat.
E.g. after drawingBufferStorage(gl.RGBA16F, 1, 1), because the framebuffer is "floatish",
readPixels's main format/type pair is RGBA/FLOAT instead of RGBA/UNSIGNED_BYTE.
-
+
If WebGLContextAttributes.alpha is false, generate INVALID_OPERATION.
-
- RGBA8 is always supported for sizedFormat.
+
+ RGB8 and RGBA8 are always supported for sizedFormat.
+
Additionally, the following enums are supported if they are currently valid for renderbufferStorage:
RGBA8
SRGB8_ALPHA8 (0x8C43) (E.g. from EXT_sRGB)
RGBA16F (0x881A) (E.g. from EXT_color_buffer_half_float)
If sizedFormat is not currently supported, generate INVALID_ENUM.
-
+
In WebGL 1.0, SRGB8_ALPHA8 requires the extension EXT_sRGB.
@@ -434,11 +437,12 @@
RGBA16F requires the extension EXT_color_buffer_float.
If width or height are greater than the limit MAX_RENDERBUFFER_SIZE,
generate INVALID_VALUE.
-
+
If allocation fails, generate OUT_OF_MEMORY.
+
drawingbufferStorage uses RGBA8,
+ texImage2D must use RGBA instead.
+ (Same with RGB8 and RGB)
+