Changeset 88 for trunk/VUT/work/ogre_changes/RenderSystem/GL
- Timestamp:
- 05/09/05 22:55:21 (20 years ago)
- Location:
- trunk/VUT/work/ogre_changes/RenderSystem/GL
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/VUT/work/ogre_changes/RenderSystem/GL/include/OgreGLHardwareOcclusionQuery.h
r61 r88 88 88 void beginOcclusionQuery(); 89 89 void endOcclusionQuery(); 90 bool pullOcclusionQuery( unsigned int* NumOfFragments); 91 bool pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag ); 92 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 93 bool resultAvailable(); 94 #endif 90 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult ); 91 bool pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, 92 const HW_OCCLUSIONQUERY flag ); 93 95 94 unsigned int getLastQuerysPixelcount() { return m_uintPixelCount; } 96 95 -
trunk/VUT/work/ogre_changes/RenderSystem/GL/src/OgreGLHardwareOcclusionQuery.cpp
r61 r88 95 95 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 96 96 { 97 //if ( m_SkipCounter == m_Skip ) { m_SkipCounter = 0; }; // Counter starts at 0 again at m_Skip 98 //if ( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 99 //{ 100 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 101 //} 97 glBeginOcclusionQueryNV_ptr( m_uintQuery[0] ); 102 98 } 103 99 } … … 107 103 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 108 104 { 109 //if( m_SkipCounter == 0 && m_uintPixelCount != 0 ) // New or none visable objects must allways be tested but visable objects can be skiped 110 //{ 111 glEndOcclusionQueryNV_ptr(); 112 //} 113 //m_SkipCounter++; 105 glEndOcclusionQueryNV_ptr(); 114 106 } 115 107 } 116 108 117 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments )109 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult) 118 110 { 119 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 111 unsigned int isAvailable = GL_TRUE; 112 113 if( m_bHWOcclusionSupport ) 120 114 { 121 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 115 if(!waitForResult) 116 { 117 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_AVAILABLE_NV, &isAvailable ); 118 } 119 120 if(isAvailable == GL_TRUE) 121 { 122 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 123 } 122 124 } 123 125 else 124 126 { 125 *NumOfFragments = 100000; // Fails quitlly -> every object tested is visable. 127 // In case hardware occlusion isn't supported, every object is set visible. 128 *NumOfFragments = 100000; 126 129 } 127 130 128 131 m_uintPixelCount = *NumOfFragments; 129 132 130 return true;133 return isAvailable == GL_TRUE; 131 134 } 132 135 133 136 //------------------------------------------------------------------ 134 // OpenGL do sn't use the flag, but to fulfilthe abstract interface we need to include this function.137 // OpenGL doesn't use the flag, but to implement the abstract interface we need to include this function. 135 138 // Using this function in OpenGL mode simple works the same way as calling the other function without the flag parameter, 136 139 // but in DX9 it works differentlly, see notes in the DX9 implementation. 137 140 //-- 138 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag )141 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag ) 139 142 { 140 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported 141 { 142 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, NumOfFragments ); 143 } 144 else 145 { 146 *NumOfFragments = 100000; // Fails quitlly -> every object tested is visable. 147 } 148 149 m_uintPixelCount = *NumOfFragments; 150 151 return true; 143 return pullOcclusionQuery(NumOfFragments, waitForResult); 152 144 } 153 145 154 #ifdef GTP_VISIBILITY_MODIFIED_OGRE155 bool GLHardwareOcclusionQuery::resultAvailable()156 {157 unsigned int result = GL_TRUE;158 159 if( m_bHWOcclusionSupport ) // Make it fail silently if hardware occlusion isn't supported160 {161 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, &result );162 }163 164 return result == GL_TRUE;165 }166 #endif167 146 } 168 147
Note: See TracChangeset
for help on using the changeset viewer.