source: osgVisual/src/core/osgVisual.cpp @ 122

Last change on this file since 122 was 114, checked in by Torben Dannhauer, 14 years ago

memory leak in clusterENet fixed

File size: 2.6 KB
RevLine 
[31]1/* -*-c++-*- osgVisual - Copyright (C) 2009-2010 Torben Dannhauer
2 *
3 * This library is based on OpenSceneGraph, open source and may be redistributed and/or modified under
4 * the terms of the OpenSceneGraph Public License (OSGPL) version 0.0 or
5 * (at your option) any later version.  The full license is in LICENSE file
6 * included with this distribution, and on the openscenegraph.org website.
7 *
8 * osgVisual requires for some proprietary modules a license from the correspondig manufacturer.
9 * You have to aquire licenses for all used proprietary modules.
10 *
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14 * OpenSceneGraph Public License for more details.
15*/
16
[87]17const 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
[88]28
[86]29//#include <windows.h>
30
[31]31#include <osg/ArgumentParser>
32#include <osg/Referenced>
33#include <osgDB/Registry>
34
35#include <visual_core.h>
36
37
[86]38
[87]39
[31]40int main(int argc, char** argv)
41{
[86]42       
43#ifdef _DEBUG
[87]44        #ifdef WIN32
[88]45                #include <leakDetection.h>      // for main: must be inside function. In classes: headerfile inside calss is sufficient
[87]46                int tmp_flag;
[86]47
[87]48                HANDLE log_file = CreateFile("mem_log.txt", GENERIC_WRITE,FILE_SHARE_WRITE,
49                        NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
[86]50
[87]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);
[86]56
[88]57                // output to the file
[87]58                _CrtSetReportFile(_CRT_ASSERT, log_file);
59                _CrtSetReportFile(_CRT_WARN, log_file);
60                _CrtSetReportFile(_CRT_ERROR, log_file);
[86]61
[87]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;
[86]66
[87]67                _CrtSetDbgFlag(tmp_flag);
68        #endif
[86]69#endif
70
[31]71    // Use an ArgumentParser object to manage the program arguments.
72        osg::ArgumentParser arguments(&argc,argv);
73
74    // Instantiate osgVisual main class
75        osg::ref_ptr<osgVisual::visual_core> core = new osgVisual::visual_core(arguments);
76
77    // Visual initialisieren
78    core->initialize();
79
[87]80        // Shut osgVisual down
81        core->shutdown();
82
[114]83        // Set Pointer to null to destroy the objects before this function ends
[86]84        core = NULL;
85
[31]86        return 0;
[86]87}
Note: See TracBrowser for help on using the repository browser.