CmGLOcclusionQuery.h 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. /*
  2. -----------------------------------------------------------------------------
  3. This source file is part of OGRE
  4. (Object-oriented Graphics Rendering Engine)
  5. For the latest info, see http://www.ogre3d.org
  6. Copyright (c) 2000-2011 Torus Knot Software Ltd
  7. Permission is hereby granted, free of charge, to any person obtaining a copy
  8. of this software and associated documentation files (the "Software"), to deal
  9. in the Software without restriction, including without limitation the rights
  10. to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  11. copies of the Software, and to permit persons to whom the Software is
  12. furnished to do so, subject to the following conditions:
  13. The above copyright notice and this permission notice shall be included in
  14. all copies or substantial portions of the Software.
  15. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  16. IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  17. FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  18. AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  19. LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  20. OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  21. THE SOFTWARE.
  22. -----------------------------------------------------------------------------
  23. */
  24. /*
  25. The nVidia occlusion query extension is defined in glext.h so you don't
  26. need anything else. You do need to look up the function, we provide a
  27. GLSupport class to do this, which has platform implementations for
  28. getProcAddress. Check the way that extensions like glActiveTextureARB are
  29. initialised and used in glRenderSystem and copy what is done there.
  30. To do: fix so dx7 and DX9 checks and flags if HW Occlusion is supported
  31. See the openGl dito for ideas what to do.
  32. */
  33. //GL_ActiveTextureARB_Func* glActiveTextureARB_ptr = (GL_ActiveTextureARB_Func)mGLSupport->getProcAddress("glActiveTextureARB");
  34. #ifndef __GLHARDWAREOCCLUSIONQUERY_H__
  35. #define __GLHARDWAREOCCLUSIONQUERY_H__
  36. #include "CmGLPrerequisites.h"
  37. #include "CmOcclusionQuery.h"
  38. namespace CamelotFramework {
  39. // If you use multiple rendering passes you can test only the first pass and all other passes don't have to be rendered
  40. // if the first pass result has too few pixels visible.
  41. // Be sure to render all occluder first and whats out so the RenderQue don't switch places on
  42. // the occluding objects and the tested objects because it thinks it's more effective..
  43. /**
  44. * This is a class that is the base class of the query class for
  45. * hardware occlusion.
  46. *
  47. * @author Lee Sandberg email: [email protected]
  48. * Updated on 13/9/2005 by Tuan Kuranes email: [email protected]
  49. */
  50. class CM_RSGL_EXPORT GLOcclusionQuery : public OcclusionQuery
  51. {
  52. //----------------------------------------------------------------------
  53. // Public methods
  54. //--
  55. public:
  56. /**
  57. * Default object constructor
  58. *
  59. */
  60. GLOcclusionQuery();
  61. /**
  62. * Object destructor
  63. */
  64. ~GLOcclusionQuery();
  65. //------------------------------------------------------------------
  66. // Occlusion query functions (see base class documentation for this)
  67. //--
  68. void beginOcclusionQuery();
  69. void endOcclusionQuery();
  70. bool pullOcclusionQuery( unsigned int* NumOfFragments);
  71. bool isStillOutstanding(void);
  72. //----------------------------------------------------------------------
  73. // private members
  74. //--
  75. private:
  76. GLuint mQueryID;
  77. };
  78. }
  79. #endif