--- title: WebGLRenderingContext.renderbufferStorage() slug: Web/API/WebGLRenderingContext/renderbufferStorage translation_of: Web/API/WebGLRenderingContext/renderbufferStorage ---
WebGL API 的 WebGLRenderingContext.renderbufferStorage()
方法用来创建和初始化一个渲染缓冲区对象的数据存储.
void gl.renderbufferStorage(target, internalFormat, width, height);
gl.RENDERBUFFER
:单一图像的缓冲数据存储在一个可渲染的内部格式。gl.RGBA4
: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits.gl.RGB565
: 5 red bits, 6 green bits, 5 blue bits.gl.RGB5_A1
: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit.gl.DEPTH_COMPONENT16
: 16 depth bits.gl.STENCIL_INDEX8
: 8 stencil bits.gl.DEPTH_STENCIL
gl.R8
gl.R8UI
gl.R8I
gl.R16UI
gl.R16I
gl.R32UI
gl.R32I
gl.RG8
gl.RG8UI
gl.RG8I
gl.RG16UI
gl.RG16I
gl.RG32UI
gl.RG32I
gl.RGB8
gl.RGBA8
gl.SRGB8_ALPHA8
(也可以作为WebGL 1的扩展,参见下面)gl.RGB10_A2
gl.RGBA8UI
gl.RGBA8I
gl.RGB10_A2UI
gl.RGBA16UI
gl.RGBA16I
gl.RGBA32I
gl.RGBA32UI
gl.DEPTH_COMPONENT24
gl.DEPTH_COMPONENT32F
gl.DEPTH24_STENCIL8
gl.DEPTH32F_STENCIL8
ext.RGBA32F_EXT
: RGBA 32-bit 浮点类型.ext.RGB32F_EXT
: RGB 32-bit 浮点类型.ext.SRGB8_ALPHA8_EXT
: 8-bit sRGB 和 alpha.gl.R16F
gl.RG16F
gl.RGBA16F
gl.R32F
gl.RG32F
gl.RGBA32F
gl.R11F_G11F_B10F
None.
gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 256, 256);
Specification | Status | Comment |
---|---|---|
{{SpecName('WebGL', "#5.14.7", "renderbufferStorage")}} | {{Spec2('WebGL')}} | WebGL初始定义. |
{{SpecName('OpenGL ES 2.0', "glRenderbufferStorage.xml", "glRenderbufferStorage")}} | {{Spec2('OpenGL ES 2.0')}} | OpenGL ES 2 API手册. |
{{SpecName('WebGL2', "#3.7.5", "getRenderbufferParameter")}} | {{Spec2('WebGL2')}} | WebGL 2更新定义. |
{{SpecName('OpenGL ES 3.0', "glRenderbufferStorage.xhtml", "glRenderbufferStorage")}} | {{Spec2('OpenGL ES 3.0')}} | OpenGL ES 3 API手册(类似). 添加许多新的内部格式. |
The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out https://github.com/mdn/browser-compat-data and send us a pull request.
{{Compat("api.WebGLRenderingContext.renderbufferStorage")}}