Ignore:
Timestamp:
05/09/05 22:55:21 (19 years ago)
Author:
mattausch
Message:
 
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  
    8888        void beginOcclusionQuery(); 
    8989        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 
    9594        unsigned int getLastQuerysPixelcount() { return m_uintPixelCount; } 
    9695 
  • trunk/VUT/work/ogre_changes/RenderSystem/GL/src/OgreGLHardwareOcclusionQuery.cpp

    r61 r88  
    9595        if( m_bHWOcclusionSupport )     // Make it fail silently if hardware occlusion isn't supported 
    9696        { 
    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] ); 
    10298        } 
    10399} 
     
    107103        if( m_bHWOcclusionSupport )     // Make it fail silently if hardware occlusion isn't supported 
    108104        { 
    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(); 
    114106        } 
    115107} 
    116108 
    117 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments)  
     109bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int * NumOfFragments, const bool waitForResult)  
    118110{ 
    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 )      
    120114        { 
    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                } 
    122124        }  
    123125        else 
    124126        { 
    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;                
    126129        } 
    127130 
    128131        m_uintPixelCount = *NumOfFragments;  
    129132 
    130         return true; 
     133        return isAvailable == GL_TRUE;   
    131134} 
    132135 
    133136//------------------------------------------------------------------ 
    134 // OpenGL dosn't use the flag, but to fulfil the 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. 
    135138// Using this function in OpenGL mode simple works the same way as calling the other function without the flag parameter, 
    136139// but in DX9 it works differentlly, see notes in the DX9 implementation. 
    137140//-- 
    138 bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const HW_OCCLUSIONQUERY flag  )  
     141bool GLHardwareOcclusionQuery::pullOcclusionQuery( unsigned int* NumOfFragments, const bool waitForResult, const HW_OCCLUSIONQUERY flag  )  
    139142{ 
    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); 
    152144} 
    153145 
    154 #ifdef GTP_VISIBILITY_MODIFIED_OGRE 
    155 bool GLHardwareOcclusionQuery::resultAvailable() 
    156 { 
    157         unsigned int result = GL_TRUE; 
    158  
    159         if( m_bHWOcclusionSupport )     // Make it fail silently if hardware occlusion isn't supported 
    160         { 
    161                 glGetOcclusionQueryuivNV_ptr( m_uintQuery[0], GL_PIXEL_COUNT_NV, &result ); 
    162         } 
    163  
    164         return result == GL_TRUE; 
    165 } 
    166 #endif 
    167146} 
    168147 
Note: See TracChangeset for help on using the changeset viewer.