blob: ef9c00baea292c30e97eb1ed6834e6a5b557bc7e (
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
|
---
title: WebGL2RenderingContext.beginQuery()
slug: Web/API/WebGL2RenderingContext/beginQuery
translation_of: Web/API/WebGL2RenderingContext/beginQuery
---
<div>{{APIRef("WebGL")}} {{SeeCompatTable}}</div>
<p><a href="/en-US/docs/Web/API/WebGL_API">WebGL 2 API</a> 的<strong><code>WebGL2RenderingContext.beginQuery()</code></strong> 方法启动一个异步查询,<code>target</code> 参数表明是哪种类型的查询。</p>
<h2 id="语法">语法</h2>
<pre class="syntaxbox">void <var>gl</var>.beginQuery(<var>target</var>, <var>query</var>);
</pre>
<h3 id="参数">参数</h3>
<dl>
<dt>target</dt>
<dd> {{domxref("GLenum")}} 指定查询个的target, 可能的值有:
<ul>
<li><code>gl.ANY_SAMPLES_PASSED</code>: Specifies an occlusion query: these queries detect whether an object is visible (whether the scoped drawing commands pass the depth test and if so, how many samples pass).</li>
<li><code>gl.ANY_SAMPLES_PASSED_CONSERVATIVE</code>: 和以上一样, 但是是一个不精确和更快的版本。</li>
<li><code>gl.TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN</code>: Number of primitives that are written to transform feedback buffers.</li>
</ul>
</dd>
<dt><code>query</code></dt>
<dd>一个{{domxref("WebGLQuery")}} 对象用于查询。</dd>
</dl>
<h3 id="返回值">返回值</h3>
<p>None.</p>
<h2 id="例子">例子</h2>
<pre class="brush: js">var query = gl.createQuery();
gl.beginQuery(gl.ANY_SAMPLES_PASSED, query);
// ...
</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.12", "beginQuery")}}</td>
<td>{{Spec2('WebGL2')}}</td>
<td>Initial definition.</td>
</tr>
<tr>
<td>{{SpecName('OpenGL ES 3.0', "glBeginQuery.xhtml", "glBeginQuery")}}</td>
<td>{{Spec2('OpenGL ES 3.0')}}</td>
<td>Man page of the (similar) OpenGL 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.WebGL2RenderingContext.beginQuery")}}</p>
<h2 id="参考">参考</h2>
<ul>
<li>{{domxref("WebGLQuery")}}</li>
</ul>
|