- Timestamp:
- 04/28/08 18:59:58 (16 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2660 r2662 132 132 { 133 133 134 135 136 134 MakeCurrent(); 135 136 float pErrorPixels = -1.0f; 137 137 138 138 … … 142 142 143 143 ViewCell *viewcell = mViewCellsManager->GetViewCell(mViewPoint); 144 145 //cout << "vp: " << mViewPoint << endl;146 144 147 145 if (viewcell == NULL) … … 154 152 155 153 if (!evaluateFilter) 156 154 pvs = viewcell->GetPvs(); 157 155 else { 158 156 159 160 161 162 157 mViewCellsManager->ApplyFilter2(viewcell, 158 false, 159 mViewCellsManager->GetFilterWidth(), 160 pvs); 163 161 } 164 162 … … 174 172 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 175 173 176 177 174 pvsSize = pvs.GetSize(); 178 cout << "vc id: " << viewcell->GetId() << " pvs: " << pvsSize << endl;179 175 180 176 RenderPvs(pvs); 181 177 182 178 //glColorMask(GL_TRUE, GL_FALSE, GL_FALSE, GL_FALSE); 183 179 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); … … 185 181 glColor3f(1,0,0); 186 182 187 183 188 184 OcclusionQuery *query = mOcclusionQueries[0]; 189 185 190 // SetupCamera();191 192 186 Intersectable::NewMail(); 193 187 … … 195 189 196 190 RenderScene(); 197 191 198 192 query->EndQuery(); 199 193 glDisable(GL_STENCIL_TEST); … … 204 198 // wait++; 205 199 // } 206 200 207 201 208 202 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 258 256 glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE); 259 257 … … 614 612 glStencilOp(GL_KEEP, GL_KEEP, GL_INCR); 615 613 616 //mUseForcedColors = true;617 618 // glColor3f(0.0f, 0.8f, 0.2f);619 // glColor3f(0.5f, 0.5f, 0.5f);620 621 614 glColor3f(0.6f, 0.6f, 0.6f); 622 615 … … 626 619 glEnable(GL_STENCIL_TEST); 627 620 628 //mUseFalseColors = true;629 630 621 glDisable(GL_LIGHTING); 622 623 SetupCamera(); 624 625 mUseForcedColors = true; 626 627 glColor3f(1.0f, 0.0f, 0.0f); 628 631 629 632 630 OcclusionQuery *query = mOcclusionQueries[0]; 633 631 query->BeginQuery(); 634 635 SetupCamera();636 637 mUseForcedColors = true;638 639 glColor3f(1.0f, 0.0f, 0.0f);640 632 641 633 RenderScene();
Note: See TracChangeset
for help on using the changeset viewer.