<html> <head> <title>OgreGLHardwareOcclusionQuery.h Source File - OGRE Documentation</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> <link type="text/css" rel="stylesheet" href="style.css"> </head> <body> <!-- Generated by Doxygen 1.3.6 --> <div class="qindex"><a class="qindex" href="index.html">Main Page</a> | <a class="qindex" href="namespaces.html">Namespace List</a> | <a class="qindex" href="hierarchy.html">Class Hierarchy</a> | <a class="qindex" href="classes.html">Alphabetical List</a> | <a class="qindex" href="annotated.html">Class List</a> | <a class="qindex" href="files.html">File List</a> | <a class="qindex" href="namespacemembers.html">Namespace Members</a> | <a class="qindex" href="functions.html">Class Members</a> | <a class="qindex" href="globals.html">File Members</a> | <a class="qindex" href="pages.html">Related Pages</a></div> <h1>OgreGLHardwareOcclusionQuery.h</h1><a href="OgreGLHardwareOcclusionQuery_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span> 00002 <span class="comment">-----------------------------------------------------------------------------</span> 00003 <span class="comment">This source file is part of OGRE</span> 00004 <span class="comment"> (Object-oriented Graphics Rendering Engine)</span> 00005 <span class="comment">For the latest info, see http://ogre.sourceforge.net/</span> 00006 <span class="comment"></span> 00007 <span class="comment">Copyright (c) 2000-2005 The OGRE Team</span> 00008 <span class="comment">Also see acknowledgements in Readme.html</span> 00009 <span class="comment"></span> 00010 <span class="comment">This program is free software; you can redistribute it and/or modify it under</span> 00011 <span class="comment">the terms of the GNU Lesser General Public License as published by the Free Software</span> 00012 <span class="comment">Foundation; either version 2 of the License, or (at your option) any later</span> 00013 <span class="comment">version.</span> 00014 <span class="comment"></span> 00015 <span class="comment">This program is distributed in the hope that it will be useful, but WITHOUT</span> 00016 <span class="comment">ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS</span> 00017 <span class="comment">FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.</span> 00018 <span class="comment"></span> 00019 <span class="comment">You should have received a copy of the GNU Lesser General Public License along with</span> 00020 <span class="comment">this program; if not, write to the Free Software Foundation, Inc., 59 Temple</span> 00021 <span class="comment">Place - Suite 330, Boston, MA 02111-1307, USA, or go to</span> 00022 <span class="comment">http://www.gnu.org/copyleft/lesser.txt.</span> 00023 <span class="comment">-----------------------------------------------------------------------------</span> 00024 <span class="comment">*/</span> 00025 00026 <span class="comment">/*</span> 00027 <span class="comment">The nVidia occlusion query extension is defined in glext.h so you don't </span> 00028 <span class="comment">need anything else. You do need to look up the function, we provide a </span> 00029 <span class="comment">GLSupport class to do this, which has platform implementations for </span> 00030 <span class="comment">getProcAddress. Check the way that extensions like glActiveTextureARB are </span> 00031 <span class="comment">initialised and used in glRenderSystem and copy what is done there.</span> 00032 <span class="comment"></span> 00033 <span class="comment"></span> 00034 <span class="comment"></span> 00035 <span class="comment"> To do: fix so dx7 and DX9 checks and flags if HW Occlusion is supported</span> 00036 <span class="comment"> See the openGl dito for ideas what to do.</span> 00037 <span class="comment"></span> 00038 <span class="comment">*/</span> 00039 00040 00041 00042 <span class="comment">//GL_ActiveTextureARB_Func* glActiveTextureARB_ptr = (GL_ActiveTextureARB_Func)mGLSupport->getProcAddress("glActiveTextureARB");</span> 00043 00044 <span class="preprocessor">#ifndef __GLHARDWAREOCCLUSIONQUERY_H__</span> 00045 <span class="preprocessor"></span><span class="preprocessor">#define __GLHARDWAREOCCLUSIONQUERY_H__</span> 00046 <span class="preprocessor"></span> 00047 <span class="preprocessor">#include "<a class="code" href="OgreGLPrerequisites_8h.html">OgreGLPrerequisites.h</a>"</span> 00048 <span class="preprocessor">#include "<a class="code" href="OgreHardwareOcclusionQuery_8h.html">OgreHardwareOcclusionQuery.h</a>"</span> 00049 00050 00051 <span class="keyword">namespace </span>Ogre { 00052 00053 00054 <span class="comment">// If you use multiple rendering passes you can test only the first pass and all other passes don't have to be rendered </span> 00055 <span class="comment">// if the first pass resultet has too few pixels visable.</span> 00056 00057 <span class="comment">// Be sure to render all occlluder first and whats out so the RenderQue don't switch places on </span> 00058 <span class="comment">// the occluding objects and the tested objects because it thinks it's more effective..</span> 00059 00060 <a name="l00068"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html">00068</a> <span class="keyword">class </span><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html">GLHardwareOcclusionQuery</a> : <span class="keyword">public</span> <a class="code" href="classOgre_1_1HardwareOcclusionQuery.html">HardwareOcclusionQuery</a> 00069 { 00070 <span class="comment">//----------------------------------------------------------------------</span> 00071 <span class="comment">// Public methods</span> 00072 <span class="comment">//--</span> 00073 <span class="keyword">public</span>: 00078 <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya0">GLHardwareOcclusionQuery</a>(); 00082 <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya1">~GLHardwareOcclusionQuery</a>(); 00083 00084 <span class="comment">//------------------------------------------------------------------</span> 00085 <span class="comment">// Occlusion query functions (see base class documentation for this)</span> 00086 <span class="comment">//--</span> 00087 00088 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya2">beginOcclusionQuery</a>(); 00089 <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya3">endOcclusionQuery</a>(); 00090 <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya4">pullOcclusionQuery</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* NumOfFragments); 00091 <span class="keywordtype">bool</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya4">pullOcclusionQuery</a>( <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span>* NumOfFragments, <span class="keyword">const</span> <a class="code" href="namespaceOgre.html#a138">HW_OCCLUSIONQUERY</a> flag ); <a name="l00092"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya6">00092</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya6">getLastQuerysPixelcount</a>() { <span class="keywordflow">return</span> m_uintPixelCount; } 00093 00094 <span class="comment">// This functions are optional, it's a simple filter that simply skipps some hardware occlusion tests on visable objects only</span> 00095 <span class="comment">// It's easy to use if you don't have to keep track on which objects are visable (can be skipped) and what objects arn't visable..</span> 00096 <span class="comment">// (None visable objects and object you introduce for the first time have allways to be tested allthough the cheepest possible </span> 00097 <span class="comment">// LOD (Level Of Detail) mesh and material wize). </span> 00098 <a name="l00109"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya7">00109</a> <span class="keywordtype">void</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya7">setSkipRate</a>( <span class="keywordtype">int</span> skip ) { m_Skip = skip; } <span class="comment">// Using 2 only 50 % of the tests are actully made and 3 results in only 33% of the tests. So on.</span> <a name="l00110"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya8">00110</a> <span class="keywordtype">int</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQuerya8">getSkipRate</a>() { <span class="keywordflow">return</span> m_Skip; } 00111 00112 00113 <span class="comment">//----------------------------------------------------------------------</span> 00114 <span class="comment">// Protected members</span> 00115 <span class="comment">//--</span> 00116 <span class="keyword">protected</span>: 00117 <a name="l00118"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryp0">00118</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_uintPixelCount; <a name="l00119"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryp1">00119</a> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryp1">m_uintQuery</a>[1]; <a name="l00120"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryp2">00120</a> <span class="keywordtype">bool</span> m_bOcclusionQuery; <a name="l00121"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryp3">00121</a> <span class="keywordtype">int</span> m_SkipCounter; <span class="comment">// m_SkipConter = m_SkipConter % m_Skip; if ( m_SkipConter == 0 && m_uintPixelCount !=0 ) TestHWOcclusion else just return </span> <a name="l00122"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryt0">00122</a> <span class="keyword">static</span> <span class="keywordtype">int</span> m_Skip; <span class="comment">// This is shared by all instancies</span> <a name="l00123"></a><a class="code" href="classOgre_1_1GLHardwareOcclusionQuery.html#Ogre_1_1GLHardwareOcclusionQueryp4">00123</a> <span class="keywordtype">bool</span> m_bHWOcclusionSupport; 00124 }; 00125 00126 00127 } 00128 00129 <span class="preprocessor">#endif </span> 00130 <span class="preprocessor"></span> </pre></div><p> Copyright © 2000-2005 by The OGRE Team<br /> Last modified Wed Feb 23 00:19:06 2005 </p> </body> </html>