aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/webglrenderingcontext/bindframebuffer/index.html
diff options
context:
space:
mode:
Diffstat (limited to 'files/zh-cn/web/api/webglrenderingcontext/bindframebuffer/index.html')
-rw-r--r--files/zh-cn/web/api/webglrenderingcontext/bindframebuffer/index.html113
1 files changed, 113 insertions, 0 deletions
diff --git a/files/zh-cn/web/api/webglrenderingcontext/bindframebuffer/index.html b/files/zh-cn/web/api/webglrenderingcontext/bindframebuffer/index.html
new file mode 100644
index 0000000000..ff033a902c
--- /dev/null
+++ b/files/zh-cn/web/api/webglrenderingcontext/bindframebuffer/index.html
@@ -0,0 +1,113 @@
+---
+title: WebGLRenderingContext.bindFramebuffer()
+slug: Web/API/WebGLRenderingContext/bindFramebuffer
+tags:
+ - API
+ - Method
+ - Reference
+ - WebGL
+ - WebGLRenderingContext
+translation_of: Web/API/WebGLRenderingContext/bindFramebuffer
+---
+<div>{{APIRef("WebGL")}}</div>
+
+<p><a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a> 的 <strong><code>WebGLRenderingContext.bindFramebuffer()</code></strong> 方法将给定的 {{domxref("WebGLFramebuffer")}} 绑定到目标。</p>
+
+<h2 id="语法">语法</h2>
+
+<pre class="syntaxbox">void <var>gl</var>.bindFramebuffer(<var>target</var>, <var>framebuffer</var>);
+</pre>
+
+<h3 id="参数">参数</h3>
+
+<dl>
+ <dt>target</dt>
+ <dd>{{domxref("GLenum")}} 指定绑定点(目标)。可能的值为:
+ <ul>
+ <li><code>gl.FRAMEBUFFER</code>: 收集用于渲染图像的颜色,alpha,深度和模板缓冲区的缓冲区数据存储。</li>
+ <li>当使用 {{domxref("WebGL2RenderingContext", "WebGL 2 context", "", 1)}} 时,可以使用以下值:
+ <ul>
+ <li><code>gl.DRAW_FRAMEBUFFER</code>: 相当于<code>gl.FRAMEBUFFER</code>, 用作绘图,渲染,清除和写入操作。</li>
+ <li><code>gl.READ_FRAMEBUFFER</code>: 用作读取操作的资源。</li>
+ </ul>
+ </li>
+ </ul>
+ </dd>
+ <dt>framebuffer</dt>
+ <dd>要绑定的 {{domxref("WebGLFramebuffer")}} 对象。</dd>
+</dl>
+
+<h3 id="返回值">返回值</h3>
+
+<p>None.</p>
+
+<h3 id="异常">异常</h3>
+
+<p>如果目标不是 <code>gl.FRAMEBUFFER</code> ,<code>gl.DRAW_FRAMEBUFFER</code> 或 <code>gl.READ_FRAMEBUFFER</code> ,则抛出 <code>gl.INVALID_ENUM</code> 错误。</p>
+
+<h2 id="示例">示例</h2>
+
+<h3 id="绑定帧缓冲区">绑定帧缓冲区</h3>
+
+<pre class="brush: js">var canvas = document.getElementById('canvas');
+var gl = canvas.getContext('webgl');
+var framebuffer = gl.createFramebuffer();
+
+gl.bindFramebuffer(gl.FRAMEBUFFER, framebuffer);
+</pre>
+
+<h3 id="获取当前绑定">获取当前绑定</h3>
+
+<p>要检查当前帧缓冲区绑定,请查询 <code>FRAMEBUFFER_BINDING</code> 常量。</p>
+
+<pre class="brush: js">gl.getParameter(gl.FRAMEBUFFER_BINDING);
+</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.6", "bindFramebuffer")}}</td>
+ <td>{{Spec2('WebGL')}}</td>
+ <td>WebGL初始定义.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('OpenGL ES 2.0', "glBindFramebuffer.xml", "glBindFramebuffer")}}</td>
+ <td>{{Spec2('OpenGL ES 2.0')}}</td>
+ <td>OpenGL API手册.</td>
+ </tr>
+ <tr>
+ <td>{{SpecName('WebGL2', "#3.7.1", "bindFrameBuffer")}}</td>
+ <td>{{Spec2('WebGL2')}}</td>
+ <td>WebGL 2更新定义.<br>
+ 新增: <code>gl.DRAW_FRAMEBUFFER</code> 和 <code>gl.READ_FRAMEBUFFER</code></td>
+ </tr>
+ <tr>
+ <td>{{SpecName('OpenGL ES 3.0', "glBindFramebuffer.xhtml", "glBindFramebuffer")}}</td>
+ <td>{{Spec2('OpenGL ES 3.0')}}</td>
+ <td>OpenGL ES 3 API手册(类似).</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", "WebGLRenderingContext.bindFramebuffer")}}</p>
+
+<h2 id="另见">另见</h2>
+
+<ul>
+ <li>{{domxref("WebGLRenderingContext.createFramebuffer()")}}</li>
+ <li>{{domxref("WebGLRenderingContext.deleteFramebuffer()")}}</li>
+ <li>{{domxref("WebGLRenderingContext.isFramebuffer()")}}</li>
+ <li>Other buffers: {{domxref("WebGLBuffer")}}, {{domxref("WebGLRenderbuffer")}}<br>
+  </li>
+</ul>