Changeset 2695 for GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Timestamp:
- 05/22/08 14:07:56 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2694 r2695 141 141 142 142 143 void QtGlRendererBuffer::RenderTrianglePvs() 144 { 145 ObjectContainer::const_iterator oit, oit_end = 146 mViewCellsManager->GetPreprocessor()->mTrianglePvs.end(); 147 148 //int sz = mViewCellsManager->GetPreprocessor()->mDummyBuffer.size(); 149 150 int i = 0; 151 for (oit = mViewCellsManager->GetPreprocessor()->mTrianglePvs.begin(); 152 oit != oit_end; ++ oit, ++ i) 153 { 154 //int dum = mViewCellsManager->GetPreprocessor()->mDummyBuffer[i]; 155 //glColor3f(0, (float)dum / 20.0f, 1); 156 if (mUseFalseColors) SetupFalseColor((*oit)->mId); 157 158 RenderIntersectable(*oit); 159 } 160 } 161 162 163 143 164 // reimplemented here so that we can snap the error windows 144 165 float QtGlRendererBuffer::GetPixelError(int &pvsSize) … … 182 203 pvsSize = pvs.GetSize(); 183 204 205 // hack: assume that view cell empty 184 206 if (pvsSize == 0) 185 207 return 0.0f; 186 187 mUseForcedColors = true;188 208 189 209 SetupCamera(); … … 270 290 271 291 // some error happened 272 if (pixelCount > pixelThres) 273 { 274 cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize << " e " << pixelCount << " vp " << mViewPoint << " vd " << mViewDirection << endl; 292 if (1)//pixelCount > pixelThres) 293 { 294 cout << "f " << mFrame << " id " << viewcell->GetId() << " pvs " << pvsSize 295 << " e " << pixelCount << " vp " << mViewPoint << " vd " << mViewDirection << endl; 275 296 276 297 if (mSnapErrorFrames) … … 292 313 im.save(qstr, "PNG"); 293 314 294 #if 0315 #if 1 295 316 /////////// 296 317 //-- output computed pvs 297 298 //mUseFalseColors = true; 318 319 //mUseFalseColors = false; 320 mUseFalseColors = true; 299 321 glPushAttrib(GL_CURRENT_BIT); 300 322 glColor3f(0, 1, 0); … … 309 331 310 332 // render pvs once 311 RenderPvs(pvs); 333 //RenderPvs(pvs); 334 RenderTrianglePvs(); 312 335 313 336 glFlush(); 314 337 315 //mUseForcedColors = false; 338 mUseFalseColors = false; 339 316 340 im = toImage(); 317 341 sprintf(filename, "error-frame-%04d-%04d-%08d-pvs.png", mFrame, viewcell->GetId(), pixelCount); … … 338 362 int pvsSize = 0; 339 363 QImage image = toImage(); 364 340 365 Intersectable::NewMail(); 341 366 … … 1218 1243 1219 1244 1245 QtGlRendererWidget::~QtGlRendererWidget() 1246 { 1247 delete mPlacer; 1248 } 1249 1250 1220 1251 void 1221 1252 QtGlRendererWidget::RenderRenderCost() … … 2571 2602 } 2572 2603 2573 2574 } 2604 /* 2605 2606 int ExampleRenderThread::faceAtPosition(const QPoint &pos) 2607 { 2608 // we need to lock the rendering context 2609 glw.lockGLContext(); 2610 // this is the same as in every OpenGL picking example 2611 const int MaxSize = 512; 2612 // see below for an explanation on the buffer content 2613 GLuint buffer[MaxSize]; 2614 GLint viewport[4]; 2615 glGetIntegerv(GL_VIEWPORT, viewport); 2616 glSelectBuffer(MaxSize, buffer); 2617 // enter select mode 2618 glRenderMode(GL_SELECT); 2619 glInitNames(); 2620 glPushName(0); 2621 glMatrixMode(GL_PROJECTION); 2622 glPushMatrix(); 2623 glLoadIdentity(); 2624 gluPickMatrix((GLdouble)pos.x(), 215 (GLdouble)(viewport[3] - pos.y()), 216 5.0, 5.0, viewport); 2625 GLfloat x = (GLfloat)viewport_size.width() / viewport_size.height(); 2626 glFrustum(-x, x, -1.0, 1.0, 4.0, 15.0); 2627 draw(); 2628 glMatrixMode(GL_PROJECTION); 2629 glPopMatrix(); 2630 // finally release the rendering context again 2631 if (!glRenderMode(GL_RENDER)) 2632 { 2633 glw.unlockGLContext(); 2634 return -1; 2635 } 2636 2637 glw.unlockGLContext(); 2638 2639 // Each hit takes 4 items in the buffer. 2640 // The first item is the number of names on the name stack when the hit occured. 2641 // The second item is the minimum z value of all the verticies that intersected 2642 // the viewing area at the time of the hit. The third item is the maximum z value 2643 // of all the vertices that intersected the viewing area at the time of the hit 2644 // and the last item is the content of the name stack at the time of the hit 2645 // (name of the object). We are only interested in the object name 2646 // (number of the surface). 2647 // return the name of the clicked surface 2648 2649 return buffer[3]; 2650 } 2651 */ 2652 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2694 r2695 76 76 int ComputePvs(ObjectContainer &objects, ObjectContainer &pvs) const; 77 77 78 /** quick hack in order to be able to render gvs pvs. 79 */ 80 void RenderTrianglePvs(); 78 81 79 82 public: … … 260 263 QtGlRendererWidget() {}; 261 264 262 ~QtGlRendererWidget() { delete mPlacer; }265 ~QtGlRendererWidget(); 263 266 264 267 void SetThread(QtPreprocessorThread *t) … … 266 269 mPreprocessorThread = t; 267 270 } 271 268 272 void RenderRenderCost(); 269 273 270 274 virtual void SetupCamera(); 271 275 272 void initializeGL() { 276 void initializeGL() 277 { 273 278 InitGL(); 274 279 }
Note: See TracChangeset
for help on using the changeset viewer.