---
title: WebGL2RenderingContext.bindBufferBase()
slug: Web/API/WebGL2RenderingContext/bindBufferBase
tags:
  - API
  - WebGL
  - WebGL2
  - 参考
  - 实验性
  - 方法
translation_of: Web/API/WebGL2RenderingContext/bindBufferBase
---
<div>{{APIRef("WebGL")}} {{SeeCompatTable}}</div>

<p><a href="/en-US/docs/Web/API/WebGL_API">WebGL 2 API</a> 的 <strong><code>WebGL2RenderingContext.bindBufferBase()</code></strong> 方法将一个 {{domxref("WebGLBuffer")}} 绑定到某个点 (<code>target</code>) 的特定的 <code>index</code>上。</p>

<h2 id="语法">语法</h2>

<pre class="syntaxbox">void <var>gl</var>.bindBufferBase(<var>target</var>, <var>index</var>, <var>buffer</var>);</pre>

<h3 id="参数">参数</h3>

<dl>
 <dt><code>target</code></dt>
 <dd>{{domxref("Glenum")}} 指定绑定操作的目标。可能的值:
 <ul>
  <li><code>gl.TRANSFORM_FEEDBACK_BUFFER</code></li>
  <li><code>gl.UNIFORM_BUFFER</code></li>
 </ul>
 </dd>
 <dt><code>index</code></dt>
 <dd>{{domxref("GLuint")}} 指定目标(<code>target</code>)的 index 。</dd>
 <dt><code>buffer</code></dt>
 <dd>绑定到目标点(<code>target</code>)的 {{domxref("WebGLBuffer")}} 。</dd>
</dl>

<h3 id="返回值">返回值</h3>

<p>无。</p>

<h2 id="示例">示例</h2>

<pre class="brush: js">gl.bindBufferBase(gl.TRANSFORM_FEEDBACK_BUFFER, 0, buffer);
</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('WebGL2', "#3.7.16", "bindBufferBase")}}</td>
   <td>{{Spec2('WebGL2')}}</td>
   <td>WebGL中初次定义。</td>
  </tr>
  <tr>
   <td>{{SpecName('OpenGL ES 3.0', "glBindBufferBase.xhtml", "glBindBufferBase")}}</td>
   <td>{{Spec2('OpenGL ES 3.0')}}</td>
   <td>OpenGL API 页面。</td>
  </tr>
 </tbody>
</table>

<h2 id="浏览器兼容性">浏览器兼容性</h2>

<p>{{Compat("api.WebGL2RenderingContext.bindBufferBase")}}</p>

<h2 id="相关链接">相关链接</h2>

<ul>
 <li>{{domxref("WebGL2RenderingContext.getIndexedParameter()")}}</li>
</ul>