1 | /*
|
---|
2 | -----------------------------------------------------------------------------
|
---|
3 | This source file is part of OGRE
|
---|
4 | (Object-oriented Graphics Rendering Engine)
|
---|
5 | For the latest info, see http://ogre.sourceforge.net/
|
---|
6 |
|
---|
7 | Copyright (c) 2000-2005 The OGRE Team
|
---|
8 | Also see acknowledgements in Readme.html
|
---|
9 |
|
---|
10 | This program is free software; you can redistribute it and/or modify it under
|
---|
11 | the terms of the GNU Lesser General Public License as published by the Free Software
|
---|
12 | Foundation; either version 2 of the License, or (at your option) any later
|
---|
13 | version.
|
---|
14 |
|
---|
15 | This program is distributed in the hope that it will be useful, but WITHOUT
|
---|
16 | ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
|
---|
17 | FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
|
---|
18 |
|
---|
19 | You should have received a copy of the GNU Lesser General Public License along with
|
---|
20 | this program; if not, write to the Free Software Foundation, Inc., 59 Temple
|
---|
21 | Place - Suite 330, Boston, MA 02111-1307, USA, or go to
|
---|
22 | http://www.gnu.org/copyleft/lesser.txt.
|
---|
23 | -----------------------------------------------------------------------------
|
---|
24 | */
|
---|
25 |
|
---|
26 | /*
|
---|
27 | The nVidia occlusion query extension is defined in glext.h so you don't
|
---|
28 | need anything else. You do need to look up the function, we provide a
|
---|
29 | GLSupport class to do this, which has platform implementations for
|
---|
30 | getProcAddress. Check the way that extensions like glActiveTextureARB are
|
---|
31 | initialised and used in glRenderSystem and copy what is done there.
|
---|
32 |
|
---|
33 |
|
---|
34 |
|
---|
35 | To do: fix so dx7 and DX9 checks and flags if HW Occlusion is supported
|
---|
36 | See the openGl dito for ideas what to do.
|
---|
37 |
|
---|
38 | */
|
---|
39 |
|
---|
40 |
|
---|
41 |
|
---|
42 | //GL_ActiveTextureARB_Func* glActiveTextureARB_ptr = (GL_ActiveTextureARB_Func)mGLSupport->getProcAddress("glActiveTextureARB");
|
---|
43 |
|
---|
44 | #ifndef __GLHARDWAREOCCLUSIONQUERY_H__
|
---|
45 | #define __GLHARDWAREOCCLUSIONQUERY_H__
|
---|
46 |
|
---|
47 | #include "OgreGLPrerequisites.h"
|
---|
48 | #include "OgreHardwareOcclusionQuery.h"
|
---|
49 |
|
---|
50 |
|
---|
51 | namespace Ogre {
|
---|
52 |
|
---|
53 |
|
---|
54 | // If you use multiple rendering passes you can test only the first pass and all other passes don't have to be rendered
|
---|
55 | // if the first pass result has too few pixels visible.
|
---|
56 |
|
---|
57 | // Be sure to render all occluder first and whats out so the RenderQue don't switch places on
|
---|
58 | // the occluding objects and the tested objects because it thinks it's more effective..
|
---|
59 |
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * This is a class that is the base class of the query class for
|
---|
63 | * hardware occlusion.
|
---|
64 | *
|
---|
65 | * @author Lee Sandberg email: lee@abcmedia.se
|
---|
66 | * Updated on 13/9/2005 by Tuan Kuranes email: tuan.kuranes@free.fr
|
---|
67 | */
|
---|
68 |
|
---|
69 | class GLHardwareOcclusionQuery : public HardwareOcclusionQuery
|
---|
70 | {
|
---|
71 | //----------------------------------------------------------------------
|
---|
72 | // Public methods
|
---|
73 | //--
|
---|
74 | public:
|
---|
75 | /**
|
---|
76 | * Default object constructor
|
---|
77 | *
|
---|
78 | */
|
---|
79 | GLHardwareOcclusionQuery();
|
---|
80 | /**
|
---|
81 | * Object destructor
|
---|
82 | */
|
---|
83 | ~GLHardwareOcclusionQuery();
|
---|
84 |
|
---|
85 | //------------------------------------------------------------------
|
---|
86 | // Occlusion query functions (see base class documentation for this)
|
---|
87 | //--
|
---|
88 | void beginOcclusionQuery();
|
---|
89 | void endOcclusionQuery();
|
---|
90 | bool pullOcclusionQuery( unsigned int* NumOfFragments);
|
---|
91 | bool isStillOutstanding(void);
|
---|
92 |
|
---|
93 |
|
---|
94 | //----------------------------------------------------------------------
|
---|
95 | // private members
|
---|
96 | //--
|
---|
97 | private:
|
---|
98 |
|
---|
99 | GLuint mQueryID;
|
---|
100 | };
|
---|
101 |
|
---|
102 | }
|
---|
103 |
|
---|
104 | #endif
|
---|
105 |
|
---|