'\" t .\" Title: glBeginQuery .\" Author: [FIXME: author] [see http://docbook.sf.net/el/author] .\" Generator: DocBook XSL Stylesheets v1.78.1 .\" Date: 05/21/2015 .\" Manual: [FIXME: manual] .\" Source: [FIXME: source] .\" Language: English .\" .TH "GLBEGINQUERY" "3G" "05/21/2015" "[FIXME: source]" "[FIXME: manual]" .\" ----------------------------------------------------------------- .\" * Define some portability stuff .\" ----------------------------------------------------------------- .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .\" http://bugs.debian.org/507673 .\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html .\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" ----------------------------------------------------------------- .\" * set default formatting .\" ----------------------------------------------------------------- .\" disable hyphenation .nh .\" disable justification (adjust text to left margin only) .ad l .\" ----------------------------------------------------------------- .\" * MAIN CONTENT STARTS HERE * .\" ----------------------------------------------------------------- .SH "NAME" glBeginQuery \- delimit the boundaries of a query object .SH "C SPECIFICATION" .HP \w'void\ glBeginQuery('u .BI "void glBeginQuery(GLenum\ " "target" ", GLuint\ " "id" ");" .HP \w'void\ glEndQuery('u .BI "void glEndQuery(GLenum\ " "target" ");" .SH "PARAMETERS FOR GLBEGINQUERY" .PP \fItarget\fR .RS 4 Specifies the target type of query object established between \fBglBeginQuery\fR and the subsequent \fBglEndQuery\fR()\&. The symbolic constant must be one of \fBGL_SAMPLES_PASSED\fR, \fBGL_ANY_SAMPLES_PASSED\fR, \fBGL_ANY_SAMPLES_PASSED_CONSERVATIVE\fR, \fBGL_PRIMITIVES_GENERATED\fR, \fBGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\fR, or \fBGL_TIME_ELAPSED\fR\&. .RE .PP \fIid\fR .RS 4 Specifies the name of a query object\&. .RE .SH "PARAMETERS FOR GLENDQUERY" .PP \fItarget\fR .RS 4 Specifies the target type of query object to be concluded\&. The symbolic constant must be one of \fBGL_SAMPLES_PASSED\fR, \fBGL_ANY_SAMPLES_PASSED\fR, \fBGL_ANY_SAMPLES_PASSED_CONSERVATIVE\fR, \fBGL_PRIMITIVES_GENERATED\fR, \fBGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\fR, or \fBGL_TIME_ELAPSED\fR\&. .RE .SH "DESCRIPTION" .PP \fBglBeginQuery\fR and \fBglEndQuery\fR() delimit the boundaries of a query object\&. \fIquery\fR must be a name previously returned from a call to \fBglGenQueries\fR()\&. If a query object with name \fIid\fR does not yet exist it is created with the type determined by \fItarget\fR\&. \fItarget\fR must be one of \fBGL_SAMPLES_PASSED\fR, \fBGL_ANY_SAMPLES_PASSED\fR, \fBGL_PRIMITIVES_GENERATED\fR, \fBGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\fR, or \fBGL_TIME_ELAPSED\fR\&. The behavior of the query object depends on its type and is as follows\&. .PP If \fItarget\fR is \fBGL_SAMPLES_PASSED\fR, \fIid\fR must be an unused name, or the name of an existing occlusion query object\&. When \fBglBeginQuery\fR is executed, the query object\*(Aqs samples\-passed counter is reset to 0\&. Subsequent rendering will increment the counter for every sample that passes the depth test\&. If the value of \fBGL_SAMPLE_BUFFERS\fR is 0, then the samples\-passed count is incremented by 1 for each fragment\&. If the value of \fBGL_SAMPLE_BUFFERS\fR is 1, then the samples\-passed count is incremented by the number of samples whose coverage bit is set\&. However, implementations, at their discression may instead increase the samples\-passed count by the value of \fBGL_SAMPLES\fR if any sample in the fragment is covered\&. When \fBglEndQuery\fR is executed, the samples\-passed counter is assigned to the query object\*(Aqs result value\&. This value can be queried by calling \fBglGetQueryObject\fR() with \fIpname\fR\fBGL_QUERY_RESULT\fR\&. .PP If \fItarget\fR is \fBGL_ANY_SAMPLES_PASSED\fR or \fBGL_ANY_SAMPLES_PASSED_CONSERVATIVE\fR, \fIid\fR must be an unused name, or the name of an existing boolean occlusion query object\&. When \fBglBeginQuery\fR is executed, the query object\*(Aqs samples\-passed flag is reset to \fBGL_FALSE\fR\&. Subsequent rendering causes the flag to be set to \fBGL_TRUE\fR if any sample passes the depth test in the case of \fBGL_ANY_SAMPLES_PASSED\fR, or if the implementation determines that any sample might pass the depth test in the case of \fBGL_ANY_SAMPLES_PASSED_CONSERVATIVE\fR\&. The implementation may be able to provide a more efficient test in the case of \fBGL_ANY_SAMPLES_PASSED_CONSERVATIVE\fR if some false positives are acceptable to the application\&. When \fBglEndQuery\fR is executed, the samples\-passed flag is assigned to the query object\*(Aqs result value\&. This value can be queried by calling \fBglGetQueryObject\fR() with \fIpname\fR\fBGL_QUERY_RESULT\fR\&. .PP If \fItarget\fR is \fBGL_PRIMITIVES_GENERATED\fR, \fIid\fR must be an unused name, or the name of an existing primitive query object previously bound to the \fBGL_PRIMITIVES_GENERATED\fR query binding\&. When \fBglBeginQuery\fR is executed, the query object\*(Aqs primitives\-generated counter is reset to 0\&. Subsequent rendering will increment the counter once for every vertex that is emitted from the geometry shader, or from the vertex shader if no geometry shader is present\&. When \fBglEndQuery\fR is executed, the primitives\-generated counter is assigned to the query object\*(Aqs result value\&. This value can be queried by calling \fBglGetQueryObject\fR() with \fIpname\fR\fBGL_QUERY_RESULT\fR\&. .PP If \fItarget\fR is \fBGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\fR, \fIid\fR must be an unused name, or the name of an existing primitive query object previously bound to the \fBGL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN\fR query binding\&. When \fBglBeginQuery\fR is executed, the query object\*(Aqs primitives\-written counter is reset to 0\&. Subsequent rendering will increment the counter once for every vertex that is written into the bound transform feedback buffer(s)\&. If transform feedback mode is not activated between the call to \fBglBeginQuery\fR and \fBglEndQuery\fR, the counter will not be incremented\&. When \fBglEndQuery\fR is executed, the primitives\-written counter is assigned to the query object\*(Aqs result value\&. This value can be queried by calling \fBglGetQueryObject\fR() with \fIpname\fR\fBGL_QUERY_RESULT\fR\&. .PP If \fItarget\fR is \fBGL_TIME_ELAPSED\fR, \fIid\fR must be an unused name, or the name of an existing timer query object previously bound to the \fBGL_TIME_ELAPSED\fR query binding\&. When \fBglBeginQuery\fR is executed, the query object\*(Aqs time counter is reset to 0\&. When \fBglEndQuery\fR is executed, the elapsed server time that has passed since the call to \fBglBeginQuery\fR is written into the query object\*(Aqs time counter\&. This value can be queried by calling \fBglGetQueryObject\fR() with \fIpname\fR\fBGL_QUERY_RESULT\fR\&. .PP Querying the \fBGL_QUERY_RESULT\fR implicitly flushes the GL pipeline until the rendering delimited by the query object has completed and the result is available\&. \fBGL_QUERY_RESULT_AVAILABLE\fR can be queried to determine if the result is immediately available or if the rendering is not yet complete\&. .SH "NOTES" .PP If the query target\*(Aqs count exceeds the maximum value representable in the number of available bits, as reported by \fBglGetQueryiv\fR() with \fItarget\fR set to the appropriate query target and \fIpname\fR\fBGL_QUERY_COUNTER_BITS\fR, the count becomes undefined\&. .PP An implementation may support 0 bits in its counter, in which case query results are always undefined and essentially useless\&. .PP When \fBGL_SAMPLE_BUFFERS\fR is 0, the samples\-passed counter of an occlusion query will increment once for each fragment that passes the depth test\&. When \fBGL_SAMPLE_BUFFERS\fR is 1, an implementation may either increment the samples\-passed counter individually for each sample of a fragment that passes the depth test, or it may choose to increment the counter for all samples of a fragment if any one of them passes the depth test\&. .PP The query targets \fBGL_ANY_SAMPLES_PASSED\fR, and \fBGL_TIME_ELAPSED\fR are availale only if the GL version is 3\&.3 or higher\&. .PP The query target \fBGL_ANY_SAMPLES_PASSED_CONSERVATIVE\fR is available only of the GL version is 4\&.3 or higher\&. .SH "ERRORS" .PP \fBGL_INVALID_ENUM\fR is generated if \fItarget\fR is not one of the accepted tokens\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fBglBeginQuery\fR is executed while a query object of the same \fItarget\fR is already active\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fBglEndQuery\fR() is executed when a query object of the same \fItarget\fR is not active\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fIid\fR is 0\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fIid\fR is the name of an already active query object\&. .PP \fBGL_INVALID_OPERATION\fR is generated if \fIid\fR refers to an existing query object whose type does not does not match \fItarget\fR\&. .SH "VERSION SUPPORT" .TS allbox tab(:); lB cB s s s s s s s s s s s lB cB cB cB cB cB cB cB cB cB cB cB cB. T{ T}:T{ \fBOpenGL Version\fR T} T{ \fBFunction / Feature Name\fR T}:T{ \fB2\&.0\fR T}:T{ \fB2\&.1\fR T}:T{ \fB3\&.0\fR T}:T{ \fB3\&.1\fR T}:T{ \fB3\&.2\fR T}:T{ \fB3\&.3\fR T}:T{ \fB4\&.0\fR T}:T{ \fB4\&.1\fR T}:T{ \fB4\&.2\fR T}:T{ \fB4\&.3\fR T}:T{ \fB4\&.4\fR T}:T{ \fB4\&.5\fR T} .T& l c c c c c c c c c c c c l c c c c c c c c c c c c. T{ \fBglBeginQuery\fR T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} T{ \fBglEndQuery\fR T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T}:T{ ✔ T} .TE .sp .SH "SEE ALSO" .PP \fBglBeginQueryIndexed\fR(), \fBglDeleteQueries\fR(), \fBglEndQuery\fR(), \fBglGenQueries\fR(), \fBglGetQueryObject\fR(), \fBglGetQueryiv\fR(), \fBglIsQuery\fR() .SH "COPYRIGHT" .PP Copyright \(co 2005 Addison\-Wesley\&. Copyright \(co 2010\-2014 Khronos Group\&. This material may be distributed subject to the terms and conditions set forth in the Open Publication License, v 1\&.0, 8 June 1999\&. \m[blue]\fBhttp://opencontent\&.org/openpub/\fR\m[]\&. .SH "COPYRIGHT" .br Copyright \(co 2005 Sams Publishing .br Copyright \(co 2010-2014 Khronos Group .br