Changeset 2663


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

debugging vp evaluation

Location:
GTP/trunk/Lib/Vis/Preprocessing
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_vienna

    r2596 r2663  
    77 
    88SCENE=../data/vienna/vienna_cropped.obj 
     9SCENE=../data/vienna/city_full.obj 
     10#SCENE=../data/vienna/city_full3.obj 
    911#VIEWCELLS=../data/vienna/vienna_cropped-seq-3000-false-20-viewcells.xml.gz 
    1012VIEWCELLS=../data/vienna/vienna_cropped-57000-viewcells.xml.gz 
  • GTP/trunk/Lib/Vis/Preprocessing/scripts/run_gvs_vps.sh

    r2661 r2663  
    3030-gvs_samples_per_pass=50000 \ 
    3131-gvs_initial_samples=16 \ 
    32 -gvs_max_viewcells=20 \ 
     32-gvs_max_viewcells=4 \ 
    3333-gvs_min_contribution=50 \ 
    3434-gvs_per_viewcell=true \ 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp

    r2662 r2663  
    435435        glClearColor(0.0f, 0.0f, 0.0f, 1.0f); 
    436436 
    437         OcclusionQuery::GenQueries(mOcclusionQueries, 10); 
     437        // create some occlusion queries 
     438        OcclusionQuery::GenQueries(mOcclusionQueries, 100); 
    438439 
    439440        SceneGraphInterior *interior = mSceneGraph->GetRoot(); 
     
    17341735float GlRenderer::GetPixelError(int &pvsSize) 
    17351736{ 
    1736   return -1.0f; 
     1737        return -1.0f; 
    17371738} 
    17381739 
     
    19511952 
    19521953                delete [] mData; 
     1954                mData = NULL; 
    19531955        } 
    19541956 
     
    19601962{ 
    19611963        glDeleteBuffersARB(1, &mVboId); 
    1962  
    1963 /* 
    1964         KdLeafContainer leaves; 
    1965         mKdTree->CollectLeaves(leaves); 
    1966  
    1967         KdLeafContainer::const_iterator kit, kit_end = leaves.end(); 
    1968  
    1969         for (kit = leaves.begin(); kit != kit_end; ++ kit) 
    1970         { 
    1971                 KdLeaf *leaf = *kit; 
    1972  
    1973                 if (leaf->mVboId == -1) 
    1974                 { 
    1975                         // delete old vbo 
    1976                         glDeleteBuffersARB(1, &leaf->mVboId); 
    1977                         leaf->mVboId = -1; 
    1978                 } 
    1979         } 
    1980 */ 
    1981 } 
    1982  
    1983  
    1984  
    1985 } 
     1964} 
     1965 
     1966 
     1967 
     1968} 
  • GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.h

    r2643 r2663  
    357357        unsigned int *mPixelBuffer; 
    358358 
    359         static void GenQueries(const int numQueries); 
     359        static void GenQueries(int numQueries); 
    360360 
    361361        virtual void SetupProjectionForViewPoint(const Vector3 &viewPoint,  
  • 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 
  • GTP/trunk/Lib/Vis/Preprocessing/src/OcclusionQuery.h

    r1001 r2663  
    2323        virtual void EndQuery(); 
    2424         
    25         static void GenQueries(std::vector<OcclusionQuery *> &queries, const int numQueries); 
     25        static void GenQueries(std::vector<OcclusionQuery *> &queries, int numQueries); 
    2626 
    2727        unsigned int GetQueryId() const; 
     
    3131 
    3232        OcclusionQuery(const unsigned int idx); 
    33         static bool sUseArbQueries; 
    34  
     33         
    3534        unsigned int mId; 
    3635}; 
  • GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp

    r2662 r2663  
    101101QtGlRendererBuffer::RenderPvs(const ObjectPvs &pvs) 
    102102{ 
    103 #if TEST_PVS_RENDERING  
    104  
    105   // Render PVS 
    106   ObjectPvsIterator it = pvs.GetIterator(); 
    107    
    108   Intersectable::NewMail(); 
    109   mCurrentFrame++; 
    110   while (it.HasMoreEntries())  
    111         { 
    112           RenderIntersectable(it.Next()); 
    113         } 
    114  
    115 #else 
    116    
    117   PreparePvs(pvs); 
    118  
    119   int offset = (int)mObjects.size() * 3; 
    120   char *arrayPtr = mUseVbos ? NULL : (char *)mData; 
    121  
    122   glVertexPointer(3, GL_FLOAT, 0, (char *)arrayPtr); 
    123   glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 
    124   glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 
    125    
    126 #endif 
     103        PreparePvs(pvs); 
     104 
     105        int offset = (int)mObjects.size() * 3; 
     106        char *arrayPtr = mUseVbos ? NULL : (char *)mData; 
     107 
     108        glVertexPointer(3, GL_FLOAT, 0, (char *)arrayPtr); 
     109        glNormalPointer(GL_FLOAT, 0, (char *)arrayPtr + offset * sizeof(Vector3)); 
     110        glDrawElements(GL_TRIANGLES, mIndexBufferSize, GL_UNSIGNED_INT, mIndices); 
    127111} 
    128112 
     
    136120        float pErrorPixels = -1.0f; 
    137121 
    138  
    139122        mUseFalseColors = false; 
    140         unsigned int pixelCount; 
     123        unsigned int pixelCount = 0; 
    141124 
    142125 
     
    153136        if (!evaluateFilter)  
    154137                pvs = viewcell->GetPvs(); 
    155         else { 
    156  
    157                 mViewCellsManager->ApplyFilter2(viewcell, 
    158                         false, 
    159                         mViewCellsManager->GetFilterWidth(), 
    160                         pvs); 
    161         } 
     138        else  
     139                mViewCellsManager->ApplyFilter2(viewcell, false, mViewCellsManager->GetFilterWidth(), pvs); 
     140 
    162141 
    163142        mUseForcedColors = true; 
     
    168147        glColor3f(0,1,0); 
    169148 
     149        glDepthFunc(GL_LESS); 
     150        glDepthMask(GL_TRUE); 
     151        glEnable(GL_DEPTH_TEST); 
    170152 
    171153        glStencilFunc(GL_EQUAL, 0x0, 0x1); 
     
    182164 
    183165 
    184         OcclusionQuery *query = mOcclusionQueries[0]; 
     166        OcclusionQuery *query = mOcclusionQueries[1]; 
    185167 
    186168        Intersectable::NewMail(); 
     
    193175        glDisable(GL_STENCIL_TEST);  
    194176 
     177 
    195178        // reenable other state 
    196         //  int wait=0; 
    197         //  while (!query.ResultAvailable()) { 
    198         //      wait++; 
    199         //  } 
     179        int wait = 0; 
     180         
     181        while (0 && !query->ResultAvailable())  
     182        { 
     183                wait ++; 
     184        } 
    200185 
    201186 
     
    16481633                                                                                                 const ViewCellInfoContainer &compareInfo) 
    16491634{ 
    1650         //cout << "comparing " << viewcells.size() << " view cells to " << compareInfo.size() << " values" << endl; 
    1651  
    16521635        if (viewcells.size() > compareInfo.size()) 
    16531636        { 
    1654                 cerr << "loaded size (" << (int)compareInfo.size() << ") does not fit to view cells size (" << (int)viewcells.size() << ")" << endl; 
     1637                cerr << "loaded size (" << (int)compareInfo.size()  
     1638                         << ") does not fit to view cells size (" << (int)viewcells.size() << ")" << endl; 
    16551639                return; 
    16561640        } 
  • GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsParser.cpp

    r2660 r2663  
    511511                        break; 
    512512                case PARSE_OBJECTSPACE_HIERARCHY: 
    513                         if ((++ nObjects % 1000) == 0) 
     513                        if ((++ nObjects % 10000) == 0) 
    514514                                cout <<"\r" << nObjects << " objects parsed\r"; 
    515515                 
Note: See TracChangeset for help on using the changeset viewer.