Ignore:
Timestamp:
04/29/08 11:19:06 (16 years ago)
Author:
mattausch
Message:

debugging vp evaluation

File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.cpp

    r2629 r2663  
    1212#endif 
    1313 
    14 #ifdef _WIN32 
     14//#ifdef _WIN32 
    1515// This Macro does not compile under LINUX 
    16 #define _ARBGL 
    17 #endif 
     16//#define _ARBGL 
     17//#endif 
     18 
    1819 
    1920using namespace std; 
    2021 
    21 namespace GtpVisibilityPreprocessor { 
    22  
    23 bool OcclusionQuery::sUseArbQueries = true; 
     22namespace GtpVisibilityPreprocessor  
     23{ 
     24 
     25const static bool sUseArbQueries = true; 
    2426 
    2527 
     
    2729{ 
    2830        GLuint id; 
    29  
    30         if (sUseArbQueries) 
    31         { 
    32 #ifdef _ARBGL 
    33           // VH 
    34           glGenQueriesARB(1, &id); 
     31         
     32        if (sUseArbQueries) 
     33        { 
     34#ifdef _WIN32 
     35                // VH 
     36                glGenQueriesARB(1, &id); 
    3537#endif 
    3638        } 
    3739        else 
    3840        {                
    39 #ifdef _ARBGL 
    40           // VH 
     41#ifdef _WIN32 
     42                // VH 
    4143                glGenOcclusionQueriesNV(1, &id); 
    4244#endif 
    4345        } 
    4446} 
     47 
    4548 
    4649OcclusionQuery::OcclusionQuery(const unsigned int idx): 
    4750mId(idx) 
    48 {} 
     51{ 
     52} 
    4953 
    5054 
     
    5357        if (sUseArbQueries) 
    5458        { 
    55 #ifdef _ARBGL 
    56           // VH 
     59#ifdef _WIN32 
     60                // VH 
    5761                glDeleteQueriesARB(1, &mId); 
    5862#endif 
     
    6064        else 
    6165        { 
    62 #ifdef _ARBGL 
    63           // VH 
     66#ifdef _WIN32 
     67                // VH 
    6468                glDeleteOcclusionQueriesNV(1, &mId); 
    6569#endif 
     
    6771         
    6872} 
    69 //----------------------------------------------------------------------- 
     73 
     74 
    7075void OcclusionQuery::BeginQuery() 
    7176{ 
    7277        if (sUseArbQueries) 
    7378        { 
    74 #ifdef _ARBGL 
    75           // VH 
     79#ifdef _WIN32 
     80                // VH 
     81                cout << "issuing arb query" << endl; 
    7682                glBeginQueryARB(GL_SAMPLES_PASSED_ARB, mId); 
    7783#endif 
     
    7985        else 
    8086        { 
    81 #ifdef _ARBGL 
    82           // VH 
     87#ifdef _WIN32 
     88                // VH 
     89                cout << "issuing nv query" << endl; 
    8390                glBeginOcclusionQueryNV(mId); 
    8491#endif 
    8592        } 
    8693} 
    87 //----------------------------------------------------------------------- 
     94 
     95 
    8896void OcclusionQuery::EndQuery() 
    8997{ 
    9098        if (sUseArbQueries) 
    9199        { 
    92 #ifdef _ARBGL 
    93           // VH 
     100#ifdef _WIN32 
     101                // VH 
     102                cout << "ending query" << endl; 
    94103                glEndQueryARB(GL_SAMPLES_PASSED_ARB); 
    95104#endif 
     
    97106        else 
    98107        { 
    99 #ifdef _ARBGL 
    100           // VH 
     108#ifdef _WIN32 
     109                // VH 
    101110                glEndOcclusionQueryNV();         
    102111#endif 
     
    110119} 
    111120 
     121 
    112122bool OcclusionQuery::ResultAvailable() const 
    113123{ 
    114         GLuint available; 
    115  
    116         if (sUseArbQueries) 
    117         { 
    118 #ifdef _ARBGL 
    119           // VH 
    120                 //GLint available; 
    121                 glGetQueryObjectuivARB(mId, 
    122                                                            GL_QUERY_RESULT_AVAILABLE_ARB, 
    123                                        &available); 
     124        GLuint available = GL_TRUE; 
     125 
     126        if (sUseArbQueries) 
     127        { 
     128#ifdef _WIN32 
     129                // VH 
     130                glGetQueryObjectuivARB(mId, GL_QUERY_RESULT_AVAILABLE_ARB, &available); 
    124131#endif           
    125                 return available == GL_TRUE; 
    126         } 
    127         else 
    128         { 
    129 #ifdef _ARBGL 
     132        } 
     133        else 
     134        { 
     135#ifdef _WIN32 
    130136          // VH 
    131137          glGetOcclusionQueryuivNV(mId, GL_PIXEL_COUNT_AVAILABLE_NV, &available); 
    132138#endif 
    133                 return available == GL_TRUE; 
    134         } 
    135  
     139        } 
     140 
     141        return available == GL_TRUE; 
    136142} 
    137143 
     
    139145unsigned int OcclusionQuery::GetQueryResult() const 
    140146{ 
    141         GLuint sampleCount; 
    142  
    143         if (sUseArbQueries) 
    144         { 
    145 #ifdef _ARBGL 
    146           // VH 
     147        GLuint sampleCount = 1; 
     148 
     149        if (sUseArbQueries) 
     150        { 
     151#ifdef _WIN32 
     152                // VH 
    147153                glGetQueryObjectuivARB(mId, GL_QUERY_RESULT_ARB, &sampleCount); 
    148154#endif 
    149                 return sampleCount; 
    150155        } 
    151156        else 
    152157        {        
    153 #ifdef _ARBGL 
    154           // VH 
     158#ifdef _WIN32 
     159                // VH 
    155160                glGetOcclusionQueryuivNV(mId, GL_PIXEL_COUNT_NV, &sampleCount); 
    156161#endif           
    157                 return sampleCount; 
    158162        }        
    159 } 
    160  
    161  
    162 void OcclusionQuery::GenQueries(std::vector<OcclusionQuery * > &queries, const int numQueries) 
     163         
     164        return sampleCount; 
     165} 
     166 
     167 
     168void OcclusionQuery::GenQueries(std::vector<OcclusionQuery * > &queries,  
     169                                                                int numQueries) 
    163170{ 
    164171        if ((int)queries.size() < numQueries) 
     
    170177                if (sUseArbQueries) 
    171178                { 
    172 #ifdef _ARBGL 
    173           // VH 
     179#ifdef _WIN32 
     180                        // VH 
    174181                        glGenQueriesARB(n, (unsigned int *)newQueries); 
     182                        cout << "creating " << n << " arb queries" <<  endl; 
    175183#endif 
    176184                } 
    177185                else 
    178186                { 
    179 #ifdef _ARBGL 
    180           // VH            
    181                   glGenOcclusionQueriesNV(n, (unsigned int *)newQueries); 
     187#ifdef _WIN32 
     188                        // VH              
     189                        glGenOcclusionQueriesNV(n, (unsigned int *)newQueries); 
     190                        cout << "creating " << n << " nv queries" <<  endl; 
    182191#endif             
    183192                } 
     
    192201        } 
    193202} 
     203 
     204 
    194205} // namespace 
Note: See TracChangeset for help on using the changeset viewer.