<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>C++, Qt et GPU &#187; Query object</title>
	<atom:link href="https://blog.developpez.com/gpu/?cat=19&#038;feed=rss2" rel="self" type="application/rss+xml" />
	<link>https://blog.developpez.com/gpu</link>
	<description></description>
	<lastBuildDate>Fri, 24 May 2013 17:02:21 +0000</lastBuildDate>
	<language>fr-FR</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>https://wordpress.org/?v=4.1.42</generator>
	<item>
		<title>Les queries objects</title>
		<link>https://blog.developpez.com/gpu/?p=5</link>
		<comments>https://blog.developpez.com/gpu/?p=5#comments</comments>
		<pubDate>Mon, 02 Apr 2012 11:10:51 +0000</pubDate>
		<dc:creator><![CDATA[gbdivers]]></dc:creator>
				<category><![CDATA[Facile]]></category>
		<category><![CDATA[OpenGL]]></category>
		<category><![CDATA[Query object]]></category>

		<guid isPermaLink="false"></guid>
		<description><![CDATA[Les queries objects permettent d&#8217;interroger OpenGL pour obtenir des informations à propos des traitements effectués. Par exemple, les queries objects permetttent de récupérer les nombres d&#8217;instances/primitives restant après un occlusion culling dans un geometry shader. On utilise également des tableaux &#8230; <a href="https://blog.developpez.com/gpu/?p=5">Lire la suite <span class="meta-nav">&#8594;</span></a>]]></description>
				<content:encoded><![CDATA[<p>Les queries objects permettent d&rsquo;interroger OpenGL pour obtenir des informations à propos des traitements effectués. Par exemple, les queries objects permetttent de récupérer les nombres d&rsquo;instances/primitives restant après un occlusion culling dans un geometry shader. On utilise également des tableaux de queries objects pour tester chaque rendu et la technique de conditional rendering pour faire les tests de culling directement sur le GPU.<br />
<span id="more-5"></span></p>
<div class="codecolorer-container cpp blackboard" style="overflow:auto;white-space:nowrap;border:1px solid #9F9F9F;width:435px;height:300px;"><table cellspacing="0" cellpadding="0"><tbody><tr><td style="padding:5px;text-align:center;color:#888888;background-color:#EEEEEE;border-right: 1px solid #9F9F9F;font: normal 12px/1.4em Monaco, Lucida Console, monospace;"><div>1<br />2<br />3<br />4<br />5<br />6<br />7<br />8<br />9<br />10<br />11<br />12<br />13<br />14<br />15<br />16<br />17<br />18<br />19<br />20<br />21<br />22<br />23<br />24<br />25<br />26<br />27<br />28<br />29<br />30<br />31<br />32<br />33<br /></div></td><td><div class="cpp codecolorer" style="padding:5px;font:normal 12px/1.4em Monaco, Lucida Console, monospace;white-space:nowrap">&nbsp; &nbsp;<span style="color: #666666;">// Pour créer des queries objects </span><br />
&nbsp; &nbsp;<span style="color: #0000ff;">void</span> glGenQueries<span style="color: #008000;">&#40;</span>GLsizei n, GLuint <span style="color: #000040;">*</span>ids<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp;GLuint query<span style="color: #008080;">;</span> <br />
&nbsp; &nbsp;GLuint queries_array<span style="color: #008000;">&#91;</span><span style="color: #0000dd;">20</span><span style="color: #008000;">&#93;</span><span style="color: #008080;">;</span> <br />
&nbsp; &nbsp;glGenQueries<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span>, <span style="color: #000040;">&amp;</span>query<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp; &nbsp;glGenQueries<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">20</span>, query_array<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666;">// Détruire des queries objects </span><br />
&nbsp; &nbsp;<span style="color: #0000ff;">void</span> glDeleteQueries<span style="color: #008000;">&#40;</span>GLsizei n, <span style="color: #0000ff;">const</span> GLuint <span style="color: #000040;">*</span>ids<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp;glDeleteQueries<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">1</span>, <span style="color: #000040;">&amp;</span>query<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp; &nbsp;glDeleteQueries<span style="color: #008000;">&#40;</span><span style="color: #0000dd;">20</span>, query_array<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666;">// Lancer la query </span><br />
&nbsp; &nbsp;glBeginQuery<span style="color: #008000;">&#40;</span>GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN, query<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">// GL_SAMPLES_PASSED : nombre de pixels écris </span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">// GL_ANY_SAMPLES_PASSED : true si au moins 1 pixel écris (GL &gt;= 3.3) </span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">// GL_PRIMITIVES_GENERATED </span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">// GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN &nbsp;</span><br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">// GL_TIME_ELAPSED : temps d'exécution en nanosecondes </span><br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666;">// Arrêter la query </span><br />
&nbsp; &nbsp;glEndQuery<span style="color: #008000;">&#40;</span>GL_SAMPLES_PASSED<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666;">// Récupérer le résultat de la query </span><br />
&nbsp; &nbsp;glGetQueryObjectuiv<span style="color: #008000;">&#40;</span>query, GL_QUERY_RESULT_AVAILABLE, <span style="color: #000040;">&amp;</span>result<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp; &nbsp;glGetQueryObject<span style="color: #008000;">&#40;</span>query, GL_QUERY_RESULT, <span style="color: #000040;">&amp;</span>count<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> <br />
&nbsp;<br />
&nbsp; &nbsp;<span style="color: #666666;">// Conditionnal rendering </span><br />
&nbsp; &nbsp;glBeginConditionalRender<span style="color: #008000;">&#40;</span>query, GL_QUERY_WAIT<span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span> &nbsp;<br />
&nbsp; &nbsp; &nbsp; &nbsp;<span style="color: #666666;">// GL_QUERY_WAIT, GL_QUERY_NO_WAIT, GL_QUERY_BY_REGION_WAIT </span><br />
&nbsp; &nbsp;glEndConditionalRender<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span><span style="color: #008080;">;</span></div></td></tr></tbody></table></div>
]]></content:encoded>
			<wfw:commentRss></wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
