aboutsummaryrefslogtreecommitdiff
path: root/files/zh-cn/web/api/oes_vertex_array_object/index.html
blob: 4e5d54f6dce88e51f8dfa03143b6fa603dca0a71 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
---
title: OES_vertex_array_object
slug: Web/API/OES_vertex_array_object
translation_of: Web/API/OES_vertex_array_object
---
<div>{{APIRef("WebGL")}}</div>

<p>拓展<strong>OES_vertex_array_object</strong><a href="/en-US/docs/Web/API/WebGL_API">WebGL API</a>的一部分,它提供了顶点数组对象 (VAOs) 可以用来封装顶点数组的状态。These objects keep pointers to vertex data and provide names for different sets of vertex data.</p>

<p>WebGL extensions are available using the {{domxref("WebGLRenderingContext.getExtension()")}} method. 更多详细信息, 参见 <a href="/en-US/docs/Web/API/WebGL_API/Using_Extensions">Using Extensions</a> in the <a href="/en-US/docs/Web/API/WebGL_API/Tutorial">WebGL tutorial</a>.</p>

<div class="note">
<p><strong>Availability:</strong> 此拓展只在{{domxref("WebGLRenderingContext", "WebGL1", "", 1)}}中有效。在{{domxref("WebGL2RenderingContext", "WebGL2", "", 1)}}当中, 这些功能可以被直接使用,且去掉了前缀 "<code>OES</code>"。</p>
</div>

<h2 id="常量">常量</h2>

<p>这个拓展提供了一个新的常量, 它可以在{{domxref("WebGLRenderingContext.getParameter()", "gl.getParameter()")}} 当中作为一个参数传递:</p>

<dl>
 <dt><code>ext.VERTEX_ARRAY_BINDING_OES</code></dt>
 <dd>当作为{{domxref("WebGLRenderingContext.getParameter()", "gl.getParameter()")}}中的<code>pname</code>参数传递时,返回一个{{domxref("WebGLVertexArrayObject")}} 对象 。</dd>
</dl>

<h2 id="函数">函数</h2>

<p>这个拓展提供了四个新的函数。</p>

<dl>
 <dt>{{domxref("OES_vertex_array_object.createVertexArrayOES()", "ext.createVertexArrayOES()")}}</dt>
 <dd>
 <p>创建一个新的 {{domxref("WebGLVertexArrayObject")}}</p>
 </dd>
 <dt>{{domxref("OES_vertex_array_object.deleteVertexArrayOES()", "ext.deleteVertexArrayOES()")}}</dt>
 <dd>
 <p>删除一个给定的 {{domxref("WebGLVertexArrayObject")}}</p>
 </dd>
 <dt>{{domxref("OES_vertex_array_object.isVertexArrayOES()", "ext.isVertexArrayOES()")}}</dt>
 <dd>
 <p>如果参数是一个 {{domxref("WebGLVertexArrayObject")}}则返回 <code>true</code> 。</p>
 </dd>
 <dt>{{domxref("OES_vertex_array_object.bindVertexArrayOES()", "ext.bindVertexArrayOES()")}}</dt>
 <dd>
 <p>绑定一个给定的{{domxref("WebGLVertexArrayObject")}}到缓冲区。</p>
 </dd>
</dl>

<h2 id="Examples">Examples</h2>

<pre class="brush: js">var oes_vao_ext = gl.getExtension('OES_vertex_array_object');
var vao = oes_vao_ext.createVertexArrayOES();
oes_vao_ext.bindVertexArrayOES(vao);

// ...
// calls to bindBuffer or vertexAttribPointer
// which will be "recorded" in the VAO
// ...
</pre>

<h2 id="Specifications">Specifications</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('OES_vertex_array_object', '', 'OES_vertex_array_object')}}</td>
   <td>{{Spec2('OES_vertex_array_object')}}</td>
   <td>Initial definition.</td>
  </tr>
 </tbody>
</table>

<h2 id="Browser_compatibility">Browser compatibility</h2>

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

<h2 id="参见">参见</h2>

<ul>
 <li>{{domxref("WebGLRenderingContext.getExtension()")}}</li>
 <li>{{domxref("WebGLRenderingContext.vertexAttribPointer()")}}</li>
 <li>WebGL2 equivalent methods:
  <ul>
   <li>{{domxref("WebGL2RenderingContext.createVertexArray()")}}</li>
   <li>{{domxref("WebGL2RenderingContext.deleteVertexArray()")}}</li>
   <li>{{domxref("WebGL2RenderingContext.isVertexArray()")}}</li>
   <li>{{domxref("WebGL2RenderingContext.bindVertexArray()")}}</li>
  </ul>
 </li>
</ul>