diff options
author | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
---|---|---|
committer | Peter Bengtsson <mail@peterbe.com> | 2020-12-08 14:40:17 -0500 |
commit | 33058f2b292b3a581333bdfb21b8f671898c5060 (patch) | |
tree | 51c3e392513ec574331b2d3f85c394445ea803c6 /files/zh-cn/web/api/webglrenderingcontext/renderbufferstorage | |
parent | 8b66d724f7caf0157093fb09cfec8fbd0c6ad50a (diff) | |
download | translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.gz translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.tar.bz2 translated-content-33058f2b292b3a581333bdfb21b8f671898c5060.zip |
initial commit
Diffstat (limited to 'files/zh-cn/web/api/webglrenderingcontext/renderbufferstorage')
-rw-r--r-- | files/zh-cn/web/api/webglrenderingcontext/renderbufferstorage/index.html | 155 |
1 files changed, 155 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/webglrenderingcontext/renderbufferstorage/index.html b/files/zh-cn/web/api/webglrenderingcontext/renderbufferstorage/index.html new file mode 100644 index 0000000000..60057a8809 --- /dev/null +++ b/files/zh-cn/web/api/webglrenderingcontext/renderbufferstorage/index.html @@ -0,0 +1,155 @@ +--- +title: WebGLRenderingContext.renderbufferStorage() +slug: Web/API/WebGLRenderingContext/renderbufferStorage +translation_of: Web/API/WebGLRenderingContext/renderbufferStorage +--- +<div>{{APIRef("WebGL")}}</div> + +<p><a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> 的 <strong><code>WebGLRenderingContext.renderbufferStorage()</code></strong> 方法用来创建和初始化一个渲染缓冲区对象的数据存储.</p> + +<h2 id="语法">语法</h2> + +<pre class="syntaxbox">void <var>gl</var>.renderbufferStorage(<var>target</var>, <var>internalFormat</var>, <var>width</var>, <var>height</var>); +</pre> + +<h3 id="参数">参数</h3> + +<dl> + <dt>target</dt> + <dd> {{domxref("Glenum")}} 指定一个渲染缓冲区对象. 可能的值: + <ul> + <li><code>gl.RENDERBUFFER</code>:单一图像的缓冲数据存储在一个可渲染的内部格式。<br> + .</li> + </ul> + </dd> + <dt>internalFormat</dt> + <dd> {{domxref("Glenum")}} 指定渲染缓冲区的内部格式. 可能的值: + <ul> + <li><code>gl.RGBA4</code>: 4 red bits, 4 green bits, 4 blue bits 4 alpha bits.</li> + <li><code>gl.RGB565</code>: 5 red bits, 6 green bits, 5 blue bits.</li> + <li><code>gl.RGB5_A1</code>: 5 red bits, 5 green bits, 5 blue bits, 1 alpha bit.</li> + <li><code>gl.DEPTH_COMPONENT16</code>: 16 depth bits.</li> + <li><code>gl.STENCIL_INDEX8</code>: 8 stencil bits.</li> + <li><code>gl.DEPTH_STENCIL</code></li> + <li>当使用{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}}时, 下面的值也是可用的: + <ul> + <li><code>gl.R8</code></li> + <li><code>gl.R8UI</code></li> + <li><code>gl.R8I</code></li> + <li><code>gl.R16UI</code></li> + <li><code>gl.R16I</code></li> + <li><code>gl.R32UI</code></li> + <li><code>gl.R32I</code></li> + <li><code>gl.RG8</code></li> + <li><code>gl.RG8UI</code></li> + <li><code>gl.RG8I</code></li> + <li><code>gl.RG16UI</code></li> + <li><code>gl.RG16I</code></li> + <li><code>gl.RG32UI</code></li> + <li><code>gl.RG32I</code></li> + <li><code>gl.RGB8</code></li> + <li><code>gl.RGBA8</code></li> + <li><code>gl.SRGB8_ALPHA8</code> (也可以作为WebGL 1的扩展,参见下面)</li> + <li><code>gl.RGB10_A2</code></li> + <li><code>gl.RGBA8UI</code></li> + <li><code>gl.RGBA8I</code></li> + <li><code>gl.RGB10_A2UI</code></li> + <li><code>gl.RGBA16UI</code></li> + <li><code>gl.RGBA16I</code></li> + <li><code>gl.RGBA32I</code></li> + <li><code>gl.RGBA32UI</code></li> + <li><code>gl.DEPTH_COMPONENT24</code></li> + <li><code>gl.DEPTH_COMPONENT32F</code></li> + <li><code>gl.DEPTH24_STENCIL8</code></li> + <li><code>gl.DEPTH32F_STENCIL8</code></li> + </ul> + </li> + <li>当使用{domxref("WEBGL_color_buffer_float")}} 扩展: + <ul> + <li><code>ext.RGBA32F_EXT</code>: RGBA 32-bit 浮点类型.</li> + <li><code>ext.RGB32F_EXT</code>: RGB 32-bit 浮点类型.</li> + </ul> + </li> + <li>当使用{domxref("EXT_sRGB")}} 扩展: + <ul> + <li><code>ext.SRGB8_ALPHA8_EXT</code>: 8-bit sRGB 和 alpha.</li> + </ul> + </li> + <li>当使用{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}} 和 {{domxref("EXT_color_buffer_float")}} 扩展: + <ul> + <li><code>gl.R16F</code></li> + <li><code>gl.RG16F</code></li> + <li><code>gl.RGBA16F</code></li> + <li><code>gl.R32F</code></li> + <li><code>gl.RG32F</code></li> + <li><code>gl.RGBA32F</code></li> + <li><code>gl.R11F_G11F_B10F</code></li> + </ul> + </li> + </ul> + </dd> + <dt>width</dt> + <dd> {{domxref("GLsizei")}} 指定渲染缓冲区的宽度(以像素为单位).</dd> + <dt>height</dt> + <dd> {{domxref("GLsizei")}} 指定渲染缓冲区的高度(以像素为单位).</dd> +</dl> + +<h3 id="返回值">返回值</h3> + +<p>None.</p> + +<h2 id="示例">示例</h2> + +<pre class="brush: js">gl.renderbufferStorage(gl.RENDERBUFFER, gl.RGBA4, 256, 256); +</pre> + +<h2 id="说明">说明</h2> + +<table class="standard-table"> + <tbody> + <tr> + <th scope="col">Specification</th> + <th scope="col">Status</th> + <th scope="col">Comment</th> + </tr> + <tr> + <td>{{SpecName('WebGL', "#5.14.7", "renderbufferStorage")}}</td> + <td>{{Spec2('WebGL')}}</td> + <td>WebGL初始定义.</td> + </tr> + <tr> + <td>{{SpecName('OpenGL ES 2.0', "glRenderbufferStorage.xml", "glRenderbufferStorage")}}</td> + <td>{{Spec2('OpenGL ES 2.0')}}</td> + <td>OpenGL ES 2 API手册.</td> + </tr> + <tr> + <td>{{SpecName('WebGL2', "#3.7.5", "getRenderbufferParameter")}}</td> + <td>{{Spec2('WebGL2')}}</td> + <td>WebGL 2更新定义.</td> + </tr> + <tr> + <td>{{SpecName('OpenGL ES 3.0', "glRenderbufferStorage.xhtml", "glRenderbufferStorage")}}</td> + <td>{{Spec2('OpenGL ES 3.0')}}</td> + <td> OpenGL ES 3 API手册(类似).<br> + 添加许多新的内部格式.</td> + </tr> + </tbody> +</table> + +<h2 id="浏览器兼容性">浏览器兼容性</h2> + +<p class="hidden">The compatibility table in this page is generated from structured data. If you'd like to contribute to the data, please check out <a href="https://github.com/mdn/browser-compat-data">https://github.com/mdn/browser-compat-data</a> and send us a pull request.</p> + +<p>{{Compat("api.WebGLRenderingContext.renderbufferStorage")}}</p> + +<h2 id="另见">另见</h2> + +<ul> + <li>{{domxref("WebGLRenderingContext.bindRenderbuffer()")}}</li> + <li>{{domxref("WebGLRenderingContext.createRenderbuffer()")}}</li> + <li>{{domxref("WebGLRenderingContext.deleteRenderbuffer()")}}</li> + <li>{{domxref("WebGLRenderingContext.getRenderbufferParameter()")}}</li> + <li>{{domxref("WEBGL_color_buffer_float")}}</li> + <li>{{domxref("EXT_sRGB")}}</li> + <li>{{domxref("EXT_color_buffer_float")}}</li> +</ul> |