Changeset 87 for osgVisual/src/core
- Timestamp:
- Jul 28, 2010, 5:13:22 PM (14 years ago)
- Location:
- osgVisual/src/core
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
osgVisual/src/core/osgVisual.cpp
r86 r87 15 15 */ 16 16 17 // Declare this in header. 17 const unsigned int MAX_NUM_EVENTS = 10; 18 19 #ifdef _DEBUG 20 #ifdef WIN32 21 // Declare this in header. 22 #define _CRTDBG_MAP_ALLOC 23 #include <stdlib.h> 24 #include <crtdbg.h> 25 #endif 26 #endif 27 18 28 //#include <windows.h> 19 #define _CRTDBG_MAP_ALLOC20 #include <crtdbg.h>21 29 22 30 #include <osg/ArgumentParser> … … 26 34 #include <visual_core.h> 27 35 28 const unsigned int MAX_NUM_EVENTS = 10; 36 29 37 30 38 … … 33 41 34 42 #ifdef _DEBUG 35 #include <leakDetection.h> // ugly but must be included inside the class 43 #ifdef WIN32 44 #include <leakDetection.h> // ugly but must be included inside the class 36 45 37 46 int tmp_flag; 38 47 39 40 48 HANDLE log_file = CreateFile("mem_log.txt", GENERIC_WRITE,FILE_SHARE_WRITE, 49 NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); 41 50 42 43 44 45 46 51 _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | 52 _CRTDBG_MODE_DEBUG); 53 _CrtSetReportMode(_CRT_WARN,_CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); 54 _CrtSetReportMode(_CRT_ERROR,_CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | 55 _CRTDBG_MODE_DEBUG); 47 56 48 49 50 51 57 // output to the file if not under VS 58 _CrtSetReportFile(_CRT_ASSERT, log_file); 59 _CrtSetReportFile(_CRT_WARN, log_file); 60 _CrtSetReportFile(_CRT_ERROR, log_file); 52 61 53 54 55 56 62 tmp_flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); 63 tmp_flag |= _CRTDBG_ALLOC_MEM_DF; 64 tmp_flag |= _CRTDBG_DELAY_FREE_MEM_DF; 65 tmp_flag |= _CRTDBG_LEAK_CHECK_DF; 57 66 58 _CrtSetDbgFlag(tmp_flag); 67 _CrtSetDbgFlag(tmp_flag); 68 #endif 59 69 #endif 60 70 … … 68 78 core->initialize(); 69 79 80 // Shut osgVisual down 81 core->shutdown(); 82 70 83 // Set Pointer to null to destroy the objects before this function ends - otherwise memory leaks wil be detected. 71 84 core = NULL; -
osgVisual/src/core/visual_core.cpp
r86 r87 28 28 visual_core::~visual_core(void) 29 29 { 30 // shut osgVisual down31 shutdown();32 33 30 OSG_NOTIFY( osg::ALWAYS ) << "visual_core destroyed." << std::endl; 34 35 31 } 36 32 … … 49 45 50 46 // Setup coordinate system node 51 rootNode = new osg::CoordinateSystemNode; 47 rootNode = new osg::CoordinateSystemNode; // todo memleakf 52 48 rootNode->setEllipsoidModel(new osg::EllipsoidModel()); 53 49 54 50 // Test memory leak (todo) 55 double* test = new double[1000];51 //double* test = new double[1000]; 56 52 57 53 #ifdef USE_SPACENAVIGATOR … … 130 126 OSG_NOTIFY( osg::ALWAYS ) << "Shutdown visual_core..." << std::endl; 131 127 128 // Shutdown Dbug HUD 129 if(hud.valid()) 130 hud->shutdown(); 132 131 // Unset scene data 133 132 viewer->setSceneData( NULL ); … … 144 143 distortion->shutdown(); 145 144 #endif 145 146 // Shutdown data 147 rootNode = NULL; 146 148 147 149 // Shutdown dataIO … … 295 297 //testObj->addUpdater( new object_updater(testObj) ); 296 298 297 osg::ref_ptr<visual_object> testObj2 = new visual_object( rootNode, "cessna" ); 299 osg::ref_ptr<visual_object> testObj2 = new visual_object( rootNode, "cessna" ); // todo memleak 298 300 //testObj2->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); 299 301 testObj2->setNewPosition( osg::DegreesToRadians(50.8123), osg::DegreesToRadians(8.94088), 600 ); 300 302 testObj2->loadGeometry( "../models/cessna.osg" ); 301 testObj2->addUpdater( new object_updater(testObj2) ); 302 303 osg::ref_ptr<visual_object> testObj3 = new visual_object( rootNode, "SAENGER1" ); 303 testObj2->addUpdater( new object_updater(testObj2) ); // todo memleak 304 305 osg::ref_ptr<visual_object> testObj3 = new visual_object( rootNode, "SAENGER1" ); // todo memleak 304 306 testObj3->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 600 ); 305 307 testObj3->loadGeometry( "../models/saenger1.flt" ); 306 testObj3->addUpdater( new object_updater(testObj3) ); 307 308 309 osg::ref_ptr<visual_object> testObj4 = new visual_object( rootNode, "SAENGER2" ); 308 testObj3->addUpdater( new object_updater(testObj3) ); // todo memleak 309 310 311 osg::ref_ptr<visual_object> testObj4 = new visual_object( rootNode, "SAENGER2" ); // todo memleak 310 312 testObj4->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 650 ); 311 313 testObj4->loadGeometry( "../models/saenger2.flt" ); 312 testObj4->addUpdater( new object_updater(testObj4) ); 314 testObj4->addUpdater( new object_updater(testObj4) ); // todo memleak 313 315 testObj4->addLabel("testLabel", "LabelTest!!\nnächste Zeile :)",osg::Vec4(1.0f,0.25f,1.0f,1.0f)); 314 316 315 osg::ref_ptr<visual_object> testObj5 = new visual_object( rootNode, "SAENGER" ); 317 osg::ref_ptr<visual_object> testObj5 = new visual_object( rootNode, "SAENGER" ); // todo memleak 316 318 testObj5->setNewPosition( osg::DegreesToRadians(47.8123), osg::DegreesToRadians(12.94088), 550 ); 317 319 testObj5->loadGeometry( "../models/saengerCombine.flt" ); 318 320 //testObj5->setScale( 2 ); 319 testObj5->addUpdater( new object_updater(testObj5) ); 321 testObj5->addUpdater( new object_updater(testObj5) ); // todo memleak 320 322 321 323 #ifdef USE_SPACENAVIGATOR … … 359 361 visual_draw2D::getInstance()->init( rootNode, viewer ); 360 362 //osg::ref_ptr<visual_hud> hud = new visual_hud(); 361 osg::ref_ptr<visual_debug_hud>hud = new visual_debug_hud();363 hud = new visual_debug_hud(); 362 364 hud->init( viewer, rootNode ); 363 365
Note: See TracChangeset
for help on using the changeset viewer.