Changeset 2560 for GTP/trunk/Lib/Vis/Preprocessing
- Timestamp:
- 12/10/07 09:12:27 (17 years ago)
- Location:
- GTP/trunk/Lib/Vis/Preprocessing
- Files:
-
- 15 edited
Legend:
- Unmodified
- Added
- Removed
-
GTP/trunk/Lib/Vis/Preprocessing/scripts/run_demo_arena
r2543 r2560 4 4 #COMMAND="./release/preprocessor.exe -preprocessor_quit_on_finish+" 5 5 COMMAND="../scripts/preprocessor.sh -preprocessor_quit_on_finish- -preprocessor_use_gl_renderer+ -preprocessor_evaluate_filter- -samples_per_evaluation=5000000 -samples_per_pass=500000 -total_samples=100000000" 6 7 6 8 7 SCENE=../data/Arena/arena-high-lods.obj -
GTP/trunk/Lib/Vis/Preprocessing/src/BvHierarchy.cpp
r2543 r2560 473 473 { 474 474 ViewCell *vc = *vit; 475 476 int vcTri;477 int vcObj;478 475 479 476 int oldVcTri = (int)vc->GetTrianglesInPvs(); -
GTP/trunk/Lib/Vis/Preprocessing/src/DifferenceSampling.cpp
r2559 r2560 103 103 // n samples per object 104 104 const int n = 50; 105 mNumSamples = mPvsDifference.size() * n;105 mNumSamples = (int)mPvsDifference.size() * n; 106 106 } 107 107 -
GTP/trunk/Lib/Vis/Preprocessing/src/DifferenceSampling.h
r2548 r2560 10 10 11 11 12 13 12 /** This sampling strategy utilizes the spatial filter to find 14 13 areas that are likely to be visible. 15 14 16 First the filter is applied. The difference set of objects (filtered pvs - unfiltered pvs) gives you the objects 17 which are not found visible yet but have a good probability that they are in fact visible, based on the current 18 state of the sampling and the size of the filter. In fact the difference set is a probably visible set. 19 20 Idea: 21 We apply the filter for n times, each time with a higher filter radius. The difference set gives you the probable visible set. 22 Then we use a certain #random samples for sampling the view cell border + the object border. 23 We can use different filter sizes to estimate the probablility distribution. The objects shouldreceived samples 15 First the filter is applied. The difference set of objects 16 (filtered pvs - unfiltered pvs) gives you the objects which 17 are not found visible yet but have a good probability that they 18 are in fact visible, based on the current 19 state of the sampling and the size of the filter. In fact the 20 difference set is a probably visible set. 21 22 Algorithm overview: 23 We apply the filter for n times, each time with a higher filter radius. 24 The difference set gives you the probable visible set. 25 Then we use a certain #random samples for sampling the view cell border + 26 the object border. We can use different filter sizes to estimate the probability 27 distribution. The objects shouldreceived samples 24 28 roughly according to their probability of becoming invisible. 25 29 */ -
GTP/trunk/Lib/Vis/Preprocessing/src/GlRenderer.cpp
r2552 r2560 76 76 mData(NULL), 77 77 mIndices(NULL), 78 mUseVbos(true), 78 //mUseVbos(true), 79 mUseVbos(false), 79 80 mCurrentFrame(-1) 80 81 { -
GTP/trunk/Lib/Vis/Preprocessing/src/Preprocessor.vcproj
r2546 r2560 126 126 OptimizeForWindowsApplication="TRUE" 127 127 AdditionalIncludeDirectories="..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;..\..\..\..\..\..\NonGTP\Boost;..\MultiLevelRayTracing;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";"$(CG_INC_PATH)";Timer;..\src\sparsehash\src\google\sparsehash;..\src\sparsehash\src\windows;..\src\sparsehash\src\google;..\src\sparsehash\src;..\src\ootl\;..\src\ootl\src\;..\src\ootl\src\cpp;..\src\ootl\src\cpp\include\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;..\src\ootl\src\cpp\include\ootl\mswin" 128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PV "128 PreprocessorDefinitions="WIN32;NDEBUG;_LIB;GTP_INTERNAL;USE_QT;USE_VERBOSE_PVS;USE_CG" 129 129 StringPooling="TRUE" 130 130 MinimalRebuild="TRUE" … … 1053 1053 </File> 1054 1054 <File 1055 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h"> 1056 </File> 1057 <File 1055 1058 RelativePath=".\sparsehash\src\windows\hash_fun.h"> 1056 </File>1057 <File1058 RelativePath=".\sparsehash\src\google\sparsehash\hash_fun.h">1059 1059 </File> 1060 1060 <File -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.cpp
r2543 r2560 690 690 glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); 691 691 692 if (1) { 692 if (1) 693 { 693 694 SetupCameraProjection(width(), height()); 694 695 SetupCamera(); 695 696 696 if (mRenderErrors) { 697 if (mRenderErrors) 698 { 697 699 RenderErrors(); 698 } else { 700 } 701 else 702 { 699 703 glColor3f(0.6f, 0.6f, 0.6f); 700 704 RenderPvs(); … … 845 849 mShowRenderCost = false; 846 850 mShowPvsSizes = false; 851 mShowPiercingRays = false; 847 852 mSpatialFilterSize = 0.01; 848 853 mPvsSize = 0; … … 883 888 connect(mControlWidget, SIGNAL(SetUseSpatialFilter(bool)), 884 889 this, SLOT(SetUseSpatialFilter(bool))); 890 connect(mControlWidget, SIGNAL(SetShowPiercingRays(bool)), this, SLOT(SetShowPiercingRays(bool))); 885 891 886 892 connect(mControlWidget, … … 1146 1152 eq[3] = mSceneCutPlane.mD; 1147 1153 1148 if (mCutViewCells) { 1154 if (mCutViewCells) 1155 { 1149 1156 glClipPlane(GL_CLIP_PLANE0, eq); 1150 1157 glEnable(GL_CLIP_PLANE0); … … 1154 1161 ViewCellContainer &viewcells = mViewCellsManager->GetViewCells(); 1155 1162 int maxPvs = -1; 1156 for (i=0; i < viewcells.size(); i++) 1163 int maxPiercingRays = 0; 1164 1165 for (i = 0; i < viewcells.size(); ++ i) 1157 1166 { 1158 1167 ViewCell *vc = viewcells[i]; … … 1162 1171 if (p > maxPvs) 1163 1172 maxPvs = p; 1164 } 1165 1166 1167 for (i=0; i < viewcells.size(); i++) { 1173 const int piercingRays = vc->GetNumPiercingRays(); 1174 if (piercingRays > maxPiercingRays) 1175 maxPiercingRays = piercingRays; 1176 } 1177 1178 1179 for (i = 0; i < viewcells.size(); ++ i) 1180 { 1168 1181 ViewCell *vc = viewcells[i]; 1169 1182 // Mesh *m = vc->GetMesh(); … … 1171 1184 RgbColor c; 1172 1185 1173 if (!mShowPvsSizes) { 1186 if (!mShowPvsSizes && !mShowPiercingRays) 1187 { 1174 1188 mWireFrame = true; 1175 1189 c = vc->GetColor(); 1176 } else { 1177 // const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 1178 const float importance = 5.0f*mTransferFunction * 1190 } 1191 else if (mShowPiercingRays) 1192 { 1193 // const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 1194 const float importance = 5.0f * mTransferFunction * 1195 ((float)vc->GetNumPiercingRays() / (float)maxPiercingRays); 1196 // c = RgbColor(importance, 1.0f - importance, 0.0f); 1197 c = RainbowColorMapping(importance); 1198 } 1199 else 1200 { 1201 // const float importance = 5.0f*mTransferFunction * ((float)vc->GetPvs().CountObjectsInPvs() / (float)maxPvs); 1202 const float importance = 5.0f * mTransferFunction * 1179 1203 ((float)vc->GetPvs().GetSize() / (float)maxPvs); 1180 // 1204 // c = RgbColor(importance, 1.0f - importance, 0.0f); 1181 1205 c = RainbowColorMapping(importance); 1182 1183 1206 } 1207 1184 1208 glColor3f(c.r, c.g, c.b); 1185 1209 … … 1191 1215 1192 1216 glPopAttrib(); 1193 1194 1217 } 1195 1218 … … 1318 1341 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowRays(bool))); 1319 1342 1320 vbox->resize(800,100); 1343 1344 cb = new QCheckBox("Show piercing rays", hbox); 1345 hlayout->addWidget(cb); 1346 cb->setChecked(false); 1347 connect(cb, SIGNAL(toggled(bool)), SIGNAL(SetShowPiercingRays(bool))); 1348 1349 vbox->resize(800,150); 1321 1350 1322 1351 -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlRenderer.h
r2543 r2560 112 112 void SetShowRenderCost(bool); 113 113 void SetShowPvsSizes(bool); 114 void SetShowPiercingRays(bool); 114 115 void SetTopView(bool); 115 116 void SetCutViewCells(bool); 116 117 void SetCutScene(bool); 117 118 118 }; 119 119 … … 137 137 bool mUseSpatialFilter; 138 138 bool mShowRenderCost; 139 bool mShowPiercingRays; 139 140 bool mShowRays; 140 141 … … 293 294 void SetShowPvsSizes(bool b) { 294 295 mShowPvsSizes = b; 296 updateGL(); 297 } 298 299 void SetShowPiercingRays(bool b) { 300 mShowPiercingRays = b; 295 301 updateGL(); 296 302 } -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtGlViewer.cpp
r2538 r2560 52 52 if (mRenderer->mRenderViewCells) 53 53 mRenderer->RenderViewCells(); 54 54 55 55 glColor3f(0.8f, 0.8f, 0.8f); 56 56 mRenderer->RenderPvs(); -
GTP/trunk/Lib/Vis/Preprocessing/src/QtInterface/QtInterface.vcproj
r2530 r2560 166 166 Name="VCCLCompilerTool" 167 167 AdditionalIncludeDirectories="..\..\src;"$(QTDIR)\include\QtCore";"$(QTDIR)\include\QtGui";"$(QTDIR)\include";"$(QTDIR)\include\QtOpenGl";..\..\..\..\..\..\..\NonGTP\Zlib\include;"$(CG_INC_PATH)"" 168 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_VERBOSE_PVS "168 PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;QTGLRENDERER_EXPORTS;USE_VERBOSE_PVS;USE_QT;USE_CG;GTP_INTERNAL" 169 169 RuntimeLibrary="2" 170 170 UsePrecompiledHeader="0" -
GTP/trunk/Lib/Vis/Preprocessing/src/TestPreprocessor.vcproj
r2559 r2560 145 145 OptimizeForWindowsApplication="TRUE" 146 146 AdditionalIncludeDirectories="..\include;..\..\..\..\..\..\NonGTP\Boost;..\src;..\..\..\..\..\..\NonGTP\Devil\include;..\..\..\..\..\..\NonGTP\Zlib\include;..\..\..\..\..\..\NonGTP\Xerces;"$(QTDIR)\include\QtOpenGl";"$(QTDIR)\include\Qt";"$(QTDIR)\include\QtCore";"$(QTDIR)\include";QtInterface;..\src\sparsehash\src\;..\src\ootl\src\include\ootl;..\src\ootl\src\include\ootl\sandbox;$(NOINHERIT)" 147 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_VERBOSE_PV "147 PreprocessorDefinitions="WIN32;NDEBUG;_CONSOLE;GTP_INTERNAL;USE_QT;USE_CG;USE_VERBOSE_PVS;QT_OPENGL_LIB;QT_DLL" 148 148 StringPooling="TRUE" 149 149 MinimalRebuild="TRUE" … … 160 160 <Tool 161 161 Name="VCLinkerTool" 162 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib QtCore4.lib qtmain.lib cg.lib cgGL.lib QtOpenGL4.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface.lib"162 AdditionalDependencies="xerces-c_2.lib glew32.lib zdll.lib zziplib.lib devil.lib glut32.lib OpenGL32.Lib glu32.lib Preprocessor.lib RTScene.lib RTWorld.lib cg.lib cgGL.lib Qt3Support4.lib QtTest4.lib QtGui4.lib QtInterface.lib QtOpenGL4.lib QtCore4.lib qtmain.lib" 163 163 OutputFile="../bin/release/Preprocessor.exe" 164 164 LinkIncremental="1" 165 AdditionalLibraryDirectories=" ..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;"$(QTDIR)\lib";.\QtInterface\Release;"$(CG_LIB_PATH)""165 AdditionalLibraryDirectories=""$(QTDIR)\lib";..\src\GL;..\lib\release;..\..\Preprocessing\lib\release;..\..\..\..\..\..\NonGTP\Boost\lib;..\..\..\..\..\..\NonGTP\Xerces\xercesc\lib;..\..\..\..\..\..\NonGTP\Zlib\lib;..\..\..\..\..\..\NonGTP\Devil\lib;..\MultiLevelRayTracing\RTScene\Release;..\MultiLevelRayTracing\RTWorld\Release;.\QtInterface\Release;"$(CG_LIB_PATH)"" 166 166 GenerateDebugInformation="FALSE" 167 167 SubSystem="1" -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.cpp
r2544 r2560 129 129 mEntriesInPvs(0), 130 130 mPvsSizeValid(false), 131 mFilteredPvsSize(0) 131 mFilteredPvsSize(0), 132 mNumPiercingRays(0) 132 133 { 133 134 mId = -100; … … 144 145 mPvsCost(0), 145 146 mPvsSizeValid(false), 146 mFilteredPvsSize(0) 147 mFilteredPvsSize(0), 148 mNumPiercingRays(0) 147 149 { 148 150 mId = -100; -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCell.h
r2544 r2560 253 253 float GetMergeCost() const; 254 254 255 void UpdatePvsCost() { 255 void UpdatePvsCost() 256 { 256 257 mPvsCost = GetPvs().EvalPvsCost(); 257 258 } 258 259 259 void SetTrianglesInPvs(const float c) { 260 void SetTrianglesInPvs(const float c) 261 { 260 262 mPvsCost = c; 261 263 } 262 264 263 void SetEntriesInPvs(const int e) { 265 void SetEntriesInPvs(const int e) 266 { 264 267 mEntriesInPvs = e; 265 268 } 266 269 267 float GetTrianglesInPvs() const { 270 float GetTrianglesInPvs() const 271 { 268 272 return mPvsCost; 269 273 } 270 274 271 int GetEntriesInPvs() const { 275 int GetEntriesInPvs() const 276 { 272 277 return mEntriesInPvs; 273 278 } … … 278 283 } 279 284 280 void SetFilteredPvsSize(const int s) { 285 void SetFilteredPvsSize(const int s) 286 { 281 287 mFilteredPvsSize = s; 282 288 } 283 289 284 //virtual int ViewCellType; 290 void IncNumPiercingRays() 291 { 292 ++ mNumPiercingRays; 293 } 294 295 void ResetNumPiercingRays() 296 { 297 mNumPiercingRays = 0; 298 } 299 300 int GetNumPiercingRays() 301 { 302 return mNumPiercingRays; 303 } 304 285 305 286 306 protected: … … 311 331 /// Filter cost of the pvs 312 332 int mFilteredPvsSize; 313 333 /// number of rays piercing this view cell 334 int mNumPiercingRays; 314 335 }; 336 315 337 316 338 inline bool SmallerPvs(const ViewCell *a, const ViewCell *b) … … 357 379 bool IsLeaf() const; 358 380 359 void SetCost(const float c) { 381 void SetCost(const float c) 382 { 360 383 mCost = c; 361 384 } 362 385 363 float GetCost() const { 386 float GetCost() const 387 { 364 388 return mCost; 365 389 } … … 580 604 581 605 582 ////////////////////////////////////////////////////////////// 583 // merge related stuff // 584 ////////////////////////////////////////////////////////////// 606 //////////////////////////////////////////// 607 //-- merge related stuff 585 608 586 609 -
GTP/trunk/Lib/Vis/Preprocessing/src/ViewCellsManager.cpp
r2548 r2560 2833 2833 // check if last ray was not same ray with reverse direction 2834 2834 if (1) 2835 // tmp matt: don't use that before origin objects areaccounted for, currently the second ray is lost!!2835 // tmp matt: don't use when origin objects are not accounted for, currently the second ray is lost!! 2836 2836 //!lastVssRay || 2837 2837 //!(ray.mOrigin == lastVssRay->mTermination) || … … 2883 2883 ray.mTermination, 2884 2884 addRays); 2885 (*it)->IncNumPiercingRays(); 2885 2886 } 2886 2887 -
GTP/trunk/Lib/Vis/Preprocessing/src/main.cpp
r2543 r2560 21 21 #include "GlobalLinesRenderer.h" 22 22 23 24 23 #include "ViewCellsManager.h" 25 24 26 #ifdef USE_QT25 //#ifdef USE_QT 27 26 #include "QtPreprocessorThread.h" 28 27 #include "QtGlViewer.h" 29 28 #include "QtGlRenderer.h" 30 #else 29 #include <QGLWidget> 30 31 //#else 31 32 #if USE_THREADS 32 33 #include "BoostPreprocessorThread.h" 33 34 #endif 34 #endif35 //#endif 35 36 36 37 #include "ResourceManager.h" … … 155 156 main(int argc, char **argv) 156 157 { 158 int returnCode = 0; 159 157 160 //Now just call this function at the start of your program and if you're 158 161 //compiling in debug mode (F5), any leaks will be displayed in the Output … … 160 163 //be ignored. Use it as you will! 161 164 //note: from GDNet Direct [3.8.04 - 3.14.04] void detectMemoryLeaks() { 162 #if 1 163 _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 164 _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 165 _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); 166 #endif 167 168 int returnCode = 0; 165 _CrtSetDbgFlag(_CRTDBG_LEAK_CHECK_DF|_CRTDBG_ALLOC_MEM_DF); 166 _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE); 167 _CrtSetReportFile(_CRT_ASSERT,_CRTDBG_FILE_STDERR); 169 168 170 169 InitTiming(); … … 185 184 } 186 185 187 188 186 Environment::GetSingleton()->GetStringValue("Scene.filename", buff); 189 187 string filename(buff); … … 216 214 } 217 215 216 218 217 //////////// 219 218 //-- initialize external ray caster … … 292 291 // create a preprocessor thread (note: capsulates calls to boost fuctions!) 293 292 PreprocessorThread *pt = NULL; 294 295 #ifdef TRY_GLOBAL_LINES 296 297 preprocessor->PrepareHwGlobalLines(); 298 globalLinesRenderer->Run(); 299 300 #else 293 294 //preprocessor->PrepareHwGlobalLines(); 295 //globalLinesRenderer->Run(); 296 297 298 bool guiSupported = false; 299 const bool useRendererBuffer = true; 300 301 int frames; 302 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 301 303 302 304 #ifdef USE_QT 303 305 304 306 // create a qt application first (must be created before any opengl widget ...) 305 307 QApplication *app = new QApplication(argc, NULL); 306 307 pt = new QtPreprocessorThread(preprocessor); 308 309 #else 308 pt = new QtPreprocessorThread(preprocessor); 309 310 if (0 && preprocessor->mUseGlRenderer && (importRandomViewCells || frames)) 311 { 312 QGLFormat f; 313 f.setStencil(true); 314 QGLFormat::setDefaultFormat(f); 315 316 // NOTE: render texture should be power of 2 and square 317 // renderer must be initialised 318 // $$matt 319 preprocessor->renderer = 320 new QtGlRendererBuffer(1024, 1024, 321 preprocessor->mSceneGraph, 322 preprocessor->mViewCellsManager, 323 preprocessor->mKdTree); 324 } 325 326 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 327 { 328 //////// 329 //-- create and run the preprocessor application in a parallel thread 330 331 cout << "using gl widget" << endl; 332 333 pt->InitThread(); 334 pt->RunThread(); 335 336 // display the render widget 337 if (!rendererWidget) 338 { 339 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 340 cout << "damn" << endl; 341 QMessageBox::information(0, "OpenGL pbuffers", 342 "This system does not support OpenGL/pbuffers.", 343 QMessageBox::Ok); 344 return NULL; 345 } 346 347 rendererWidget = 348 new QtGlRendererWidget(preprocessor->mSceneGraph, 349 preprocessor->mViewCellsManager, 350 preprocessor->mKdTree); 351 352 rendererWidget->Show(); 353 354 if (1) // not working with vbo 355 { 356 QtGlViewer *viewer = 357 new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget); 358 viewer->show(); 359 } 360 361 guiSupported = true; 362 } 363 364 bool exportRandomViewCells; 365 Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", 366 exportRandomViewCells); 367 368 if (exportRandomViewCells) 369 { 370 cout << "exporting random view cells" << endl; 371 preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile); 372 cout << "finished" << endl; 373 } 374 375 /*bool evaluatePixelError; 376 Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluatePixelError", evaluatePixelError); 377 378 if (evaluatePixelError) 379 { 380 cout << "evaluating pixel error" << endl; 381 preprocessor->ComputeRenderError(); 382 }*/ 383 384 qApp->exec(); 385 } 386 #else // USE_QUT 310 387 311 388 //#if USE_THREADS … … 319 396 preprocessor->SetThread(pt); 320 397 321 bool guiSupported = false; 322 bool useRendererBuffer = true; 323 324 int frames; 325 Environment::GetSingleton()->GetIntValue("Preprocessor.pvsRenderErrorSamples", frames); 326 327 328 #ifdef USE_QT 329 330 if (0 && preprocessor->mUseGlRenderer && (importRandomViewCells || frames)) 331 { 332 QGLFormat f; 333 f.setStencil(true); 334 QGLFormat::setDefaultFormat(f); 335 336 // NOTE: render texture should be power of 2 and square 337 // renderer must be initialised 338 // $$matt 339 preprocessor->renderer = 340 new QtGlRendererBuffer(1024, 1024, 341 preprocessor->mSceneGraph, 342 preprocessor->mViewCellsManager, 343 preprocessor->mKdTree); 344 } 345 #endif 346 347 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 348 { 349 #ifdef USE_QT 350 351 //////// 352 // create and run the preprocessor application in a parallel thread 353 354 cout << "using gl widget" << endl; 355 356 pt->InitThread(); 357 pt->RunThread(); 358 359 // display the render widget 360 if (!rendererWidget) 361 { 362 363 if (!QGLFormat::hasOpenGL() || !QGLPixelBuffer::hasOpenGLPbuffers()) { 364 QMessageBox::information(0, "OpenGL pbuffers", 365 "This system does not support OpenGL/pbuffers.", 366 QMessageBox::Ok); 367 return NULL; 368 } 369 370 rendererWidget = 371 new QtGlRendererWidget(preprocessor->mSceneGraph, 372 preprocessor->mViewCellsManager, 373 preprocessor->mKdTree); 374 375 rendererWidget->Show(); 376 377 if (0) 378 { 379 QtGlViewer *viewer = 380 new QtGlViewer(NULL, (QtGlRendererWidget *)rendererWidget); 381 viewer->show(); 382 } 383 384 guiSupported = true; 385 } 386 387 388 bool exportRandomViewCells; 389 Environment::GetSingleton()->GetBoolValue("ViewCells.exportRandomViewCells", 390 exportRandomViewCells); 391 392 if (exportRandomViewCells) 393 { 394 cout << "exporting random view cells" << endl; 395 preprocessor->mViewCellsManager->ExportRandomViewCells(viewCellPointsFile); 396 cout << "finished" << endl; 397 } 398 399 /*bool evaluatePixelError; 400 Environment::GetSingleton()->GetBoolValue("Preprocessor.evaluatePixelError", evaluatePixelError); 401 402 if (evaluatePixelError) 403 { 404 cout << "evaluating pixel error" << endl; 405 preprocessor->ComputeRenderError(); 406 }*/ 407 408 qApp->exec(); 409 #endif 410 } 411 412 // no gui available 413 if (!guiSupported) 414 { 415 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 416 cout << "warning: gui not supported!" << endl; 417 418 preprocessor->mUseGlRenderer = false; 419 preprocessor->mUseGlDebugger = false; 420 } 421 422 if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger)) 423 { 424 cout << "executing main thread" << endl; 425 // just call the mail method -> will be executed in the main thread 426 pt->Main(); 427 } 428 #endif 429 430 // release memory 431 Cleanup(); 432 delete pt; 433 434 return returnCode; 398 // no gui available 399 if (!guiSupported) 400 { 401 if (preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger) 402 cout << "warning: gui not supported!" << endl; 403 404 preprocessor->mUseGlRenderer = false; 405 preprocessor->mUseGlDebugger = false; 406 } 407 408 if (!(preprocessor->mUseGlRenderer || preprocessor->mUseGlDebugger)) 409 { 410 cout << "executing main thread" << endl; 411 // just call the mail method -> will be executed in the main thread 412 pt->Main(); 413 } 414 415 // release memory 416 Cleanup(); 417 delete pt; 418 419 return returnCode; 435 420 } 436 421
Note: See TracChangeset
for help on using the changeset viewer.