Ignore:
Timestamp:
04/28/08 18:59:58 (16 years ago)
Author:
mattausch
Message:

working on gvs pixel error evaluation bugfixing

File:
1 edited

Legend:

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

    r2660 r2662  
    132132{ 
    133133 
    134   MakeCurrent(); 
    135  
    136   float pErrorPixels = -1.0f; 
     134        MakeCurrent(); 
     135 
     136        float pErrorPixels = -1.0f; 
    137137 
    138138 
     
    142142 
    143143        ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 
    144          
    145         //cout << "vp: " << mViewPoint << endl; 
    146144 
    147145        if (viewcell == NULL) 
     
    154152 
    155153        if (!evaluateFilter)  
    156           pvs = viewcell->GetPvs(); 
     154                pvs = viewcell->GetPvs(); 
    157155        else { 
    158156 
    159           mViewCellsManager->ApplyFilter2(viewcell, 
    160                                                                           false, 
    161                                                                           mViewCellsManager->GetFilterWidth(), 
    162                                                                           pvs); 
     157                mViewCellsManager->ApplyFilter2(viewcell, 
     158                        false, 
     159                        mViewCellsManager->GetFilterWidth(), 
     160                        pvs); 
    163161        } 
    164162 
     
    174172        glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);  
    175173 
    176  
    177174        pvsSize = pvs.GetSize(); 
    178         cout << "vc id: " << viewcell->GetId() << " pvs: " << pvsSize << endl; 
    179175         
    180176        RenderPvs(pvs); 
    181          
     177 
    182178        //glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 
    183179        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     
    185181        glColor3f(1,0,0); 
    186182 
    187          
     183 
    188184        OcclusionQuery *query = mOcclusionQueries[0]; 
    189185 
    190         //      SetupCamera(); 
    191  
    192186        Intersectable::NewMail(); 
    193187 
     
    195189 
    196190        RenderScene(); 
    197          
     191 
    198192        query->EndQuery(); 
    199193        glDisable(GL_STENCIL_TEST);  
     
    204198        //      wait++; 
    205199        //  } 
    206          
     200 
    207201 
    208202        pixelCount = query->GetQueryResult(); 
    209         //      cout<<"pc="<<pixelCount<<endl; 
    210          
    211         pErrorPixels = ((float)pixelCount)/(GetWidth()*GetHeight()); 
    212  
    213  
    214         if (mSnapErrorFrames && (pErrorPixels >= 0.01f)) { 
    215           glReadBuffer(GL_BACK); 
    216           //glReadBuffer(GL_FRONT); 
    217            
    218           char filename[256]; 
    219           sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 
    220           QImage im = toImage(); 
    221           string str = mSnapPrefix + filename; 
    222           QString qstr(str.c_str()); 
    223            
    224           im.save(qstr, "PNG"); 
    225           if (0) { //0 && mFrame == 1543) { 
    226                 int x,y; 
    227                 int lastIndex = -1; 
    228                 for (y=0; y < im.height(); y++) 
    229                   for (x=0; x < im.width(); x++) { 
    230                         QRgb p = im.pixel(x,y); 
    231                         int index = qRed(p) + (qGreen(p)<<8) + (qBlue(p)<<16); 
    232                         if (qGreen(p) != 255 && index!=0) { 
    233                           if (index != lastIndex) { 
    234                                 //                              Debug<<"ei="<<index<<" "; 
    235                                 lastIndex = index; 
    236                           } 
    237                         } 
    238                   } 
    239           } 
    240            
    241           mUseFalseColors = false; 
    242           glPushAttrib(GL_CURRENT_BIT); 
    243           glColor3f(0,1,0); 
    244           glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    245           glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
    246            
    247           RenderPvs(pvs); 
    248  
    249           mUseForcedColors = false; 
    250           im = toImage(); 
    251           sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 
    252           str = mSnapPrefix + filename; 
    253           qstr = str.c_str(); 
    254           im.save(qstr, "PNG"); 
    255           glPopAttrib(); 
    256         } 
    257          
     203 
     204        if ((pixelCount > 0) && (pvsSize > 0)) 
     205        { 
     206                cout << "vc id: " << viewcell->GetId() << " pvs: " << pvsSize << " pc: " << pixelCount << endl; 
     207        } 
     208 
     209        pErrorPixels = ((float)pixelCount) / (GetWidth() * GetHeight()); 
     210 
     211 
     212        if (mSnapErrorFrames && (pixelCount > 0)) { 
     213                glReadBuffer(GL_BACK); 
     214                //glReadBuffer(GL_FRONT); 
     215 
     216                char filename[256]; 
     217                sprintf(filename, "error-frame-%04d-%0.5f.png", mFrame, pErrorPixels); 
     218                QImage im = toImage(); 
     219                string str = mSnapPrefix + filename; 
     220                QString qstr(str.c_str()); 
     221 
     222                im.save(qstr, "PNG"); 
     223                if (0) { //0 && mFrame == 1543) { 
     224                        int x,y; 
     225                        int lastIndex = -1; 
     226                        for (y=0; y < im.height(); y++) 
     227                                for (x=0; x < im.width(); x++) { 
     228                                        QRgb p = im.pixel(x,y); 
     229                                        int index = qRed(p) + (qGreen(p)<<8) + (qBlue(p)<<16); 
     230                                        if (qGreen(p) != 255 && index!=0) { 
     231                                                if (index != lastIndex) { 
     232                                                        //                              Debug<<"ei="<<index<<" "; 
     233                                                        lastIndex = index; 
     234                                                } 
     235                                        } 
     236                                } 
     237                } 
     238 
     239                mUseFalseColors = false; 
     240                glPushAttrib(GL_CURRENT_BIT); 
     241                glColor3f(0,1,0); 
     242                glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
     243                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 
     244 
     245                RenderPvs(pvs); 
     246 
     247                mUseForcedColors = false; 
     248                im = toImage(); 
     249                sprintf(filename, "error-frame-%04d-%0.5f-pvs.png", mFrame, pErrorPixels); 
     250                str = mSnapPrefix + filename; 
     251                qstr = str.c_str(); 
     252                im.save(qstr, "PNG"); 
     253                glPopAttrib(); 
     254        } 
     255 
    258256        glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 
    259257 
     
    614612        glStencilOp(GL_KEEP, GL_KEEP, GL_INCR);  
    615613 
    616         //mUseForcedColors = true; 
    617  
    618         //      glColor3f(0.0f, 0.8f, 0.2f); 
    619         //      glColor3f(0.5f, 0.5f, 0.5f); 
    620  
    621614        glColor3f(0.6f, 0.6f, 0.6f); 
    622615 
     
    626619        glEnable(GL_STENCIL_TEST);  
    627620 
    628         //mUseFalseColors = true; 
    629  
    630621        glDisable(GL_LIGHTING); 
     622 
     623        SetupCamera(); 
     624 
     625        mUseForcedColors = true; 
     626 
     627        glColor3f(1.0f, 0.0f, 0.0f); 
     628 
    631629 
    632630        OcclusionQuery *query = mOcclusionQueries[0]; 
    633631        query->BeginQuery(); 
    634  
    635         SetupCamera(); 
    636  
    637         mUseForcedColors = true; 
    638  
    639         glColor3f(1.0f, 0.0f, 0.0f); 
    640632 
    641633        RenderScene(); 
Note: See TracChangeset for help on using the changeset viewer.