1 <?xml version=
"1.0" encoding=
"UTF-8"?>
2 <!DOCTYPE book PUBLIC
"-//OASIS//DTD DocBook MathML Module V1.1b1//EN"
3 "http://www.oasis-open.org/docbook/xml/mathml/1.1CR1/dbmathml.dtd">
4 <refentry id=
"glBeginQuery">
9 <holder>Sams Publishing
</holder>
12 <refentrytitle>glBeginQuery
</refentrytitle>
13 <manvolnum>3G
</manvolnum>
16 <refname>glBeginQuery
</refname>
17 <refpurpose>delimit the boundaries of a query object
</refpurpose>
19 <refsynopsisdiv><title>C Specification
</title>
22 <funcdef>void
<function>glBeginQuery
</function></funcdef>
23 <paramdef>GLenum
<parameter>target
</parameter></paramdef>
24 <paramdef>GLuint
<parameter>id
</parameter></paramdef>
28 <!-- eqn: ignoring delim $$ -->
29 <refsect1 id=
"parameters"><title>Parameters
</title>
32 <term><parameter>target
</parameter></term>
35 Specifies the target type of query object established between
36 <function>glBeginQuery
</function> and the subsequent
<citerefentry><refentrytitle>glEndQuery
</refentrytitle></citerefentry>.
37 The symbolic constant must be
<constant>GL_SAMPLES_PASSED
</constant>.
42 <term><parameter>id
</parameter></term>
45 Specifies the name of a query object.
51 <refsynopsisdiv><title>C Specification
</title>
54 <funcdef>void
<function>glEndQuery
</function></funcdef>
55 <paramdef>GLenum
<parameter>target
</parameter></paramdef>
59 <!-- eqn: ignoring delim $$ -->
60 <refsect1 id=
"parameters2"><title>Parameters
</title>
63 <term><parameter>target
</parameter></term>
66 Specifies the target type of query object to be concluded.
67 The symbolic constant must be
<constant>GL_SAMPLES_PASSED
</constant>.
73 <refsect1 id=
"description"><title>Description
</title>
75 <function>glBeginQuery
</function> and
<citerefentry><refentrytitle>glEndQuery
</refentrytitle></citerefentry> delimit the
76 boundaries of a query object. If a query object with name
<parameter>id
</parameter> does not yet exist it is created.
79 When
<function>glBeginQuery
</function> is executed, the query object's samples-passed counter is reset to
0. Subsequent
80 rendering will increment the counter once for every sample that passes the depth test. When
<function>glEndQuery
</function>
81 is executed, the samples-passed counter is assigned to the query object's result value. This value can be queried by
82 calling
<citerefentry><refentrytitle>glGetQueryObject
</refentrytitle></citerefentry> with
<parameter>pname
</parameter>
83 <constant>GL_QUERY_RESULT
</constant>.
86 Querying the
<constant>GL_QUERY_RESULT
</constant> implicitly flushes the GL pipeline until the rendering delimited by the
87 query object has completed and the result is available.
<constant>GL_QUERY_RESULT_AVAILABLE
</constant> can be queried to
88 determine if the result is immediately available or if the rendering is not yet complete.
91 <refsect1 id=
"notes"><title>Notes
</title>
93 If the samples-passed count exceeds the maximum value representable in the number of available bits, as reported by
94 <citerefentry><refentrytitle>glGetQueryiv
</refentrytitle></citerefentry> with
<parameter>pname
</parameter>
95 <constant>GL_QUERY_COUNTER_BITS
</constant>, the count becomes undefined.
98 An implementation may support
0 bits in its samples-passed counter, in which case query results are always undefined
99 and essentially useless.
102 When
<constant>GL_SAMPLE_BUFFERS
</constant> is
0, the samples-passed counter will increment once for each fragment that passes
103 the depth test. When
<constant>GL_SAMPLE_BUFFERS
</constant> is
1, an implementation may either increment the samples-passed
104 counter individually for each sample of a fragment that passes the depth test, or it may choose to increment the counter for
105 all samples of a fragment if any one of them passes the depth test.
108 <function>glBeginQuery
</function> and
<citerefentry><refentrytitle>glEndQuery
</refentrytitle></citerefentry>
109 are available only if the GL version is
1.5 or greater.
112 <refsect1 id=
"errors"><title>Errors
</title>
114 <constant>GL_INVALID_ENUM
</constant> is generated if
<parameter>target
</parameter> is not
<constant>GL_SAMPLES_PASSED
</constant>.
117 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>glBeginQuery
</function> is executed while
118 a query object of the same
<parameter>target
</parameter> is already active.
121 <constant>GL_INVALID_OPERATION
</constant> is generated if
<citerefentry><refentrytitle>glEndQuery
</refentrytitle></citerefentry>
122 is executed when a query object of the same
<parameter>target
</parameter> is not active.
125 <constant>GL_INVALID_OPERATION
</constant> is generated if
<parameter>id
</parameter> is
0.
128 <constant>GL_INVALID_OPERATION
</constant> is generated if
<parameter>id
</parameter> is the name of an already active query object.
131 <constant>GL_INVALID_OPERATION
</constant> is generated if
<function>glBeginQuery
</function> or
132 <citerefentry><refentrytitle>glEndQuery
</refentrytitle></citerefentry> is executed between the execution of
133 <citerefentry><refentrytitle>glBegin
</refentrytitle></citerefentry> and the corresponding execution of
134 <citerefentry><refentrytitle>glEnd
</refentrytitle></citerefentry>.
137 <refsect1 id=
"seealso"><title>See Also
</title>
139 <citerefentry><refentrytitle>glDeleteQueries
</refentrytitle></citerefentry>,
140 <citerefentry><refentrytitle>glGenQueries
</refentrytitle></citerefentry>,
141 <citerefentry><refentrytitle>glGetQueryiv
</refentrytitle></citerefentry>,
142 <citerefentry><refentrytitle>glGetQueryObject
</refentrytitle></citerefentry>,
143 <citerefentry><refentrytitle>glIsQuery
</refentrytitle></citerefentry>
146 <refsect1 id=
"Copyright"><title>Copyright
</title>
148 Copyright
<trademark class=
"copyright"></trademark> 2005 Addison-Wesley.
149 This material may be distributed subject to the terms and conditions set forth in
150 the Open Publication License, v
1.0,
8 June
1999.
151 <ulink url=
"http://opencontent.org/openpub/">http://opencontent.org/openpub/
</ulink>.