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 | |
---|
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 | |
---|
28 | |
---|
29 | //#include <windows.h> |
---|
30 | |
---|
31 | #include <osg/ArgumentParser> |
---|
32 | #include <osg/Referenced> |
---|
33 | #include <osgDB/Registry> |
---|
34 | |
---|
35 | #include <visual_core.h> |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | |
---|
40 | int main(int argc, char** argv) |
---|
41 | { |
---|
42 | |
---|
43 | #ifdef _DEBUG |
---|
44 | #ifdef WIN32 |
---|
45 | #include <leakDetection.h> // for main: must be inside function. In classes: headerfile inside calss is sufficient |
---|
46 | int tmp_flag; |
---|
47 | |
---|
48 | HANDLE log_file = CreateFile("mem_log.txt", GENERIC_WRITE,FILE_SHARE_WRITE, |
---|
49 | NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); |
---|
50 | |
---|
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); |
---|
56 | |
---|
57 | // output to the file |
---|
58 | _CrtSetReportFile(_CRT_ASSERT, log_file); |
---|
59 | _CrtSetReportFile(_CRT_WARN, log_file); |
---|
60 | _CrtSetReportFile(_CRT_ERROR, log_file); |
---|
61 | |
---|
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; |
---|
66 | |
---|
67 | _CrtSetDbgFlag(tmp_flag); |
---|
68 | #endif |
---|
69 | #endif |
---|
70 | |
---|
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 | |
---|
80 | // Shut osgVisual down |
---|
81 | core->shutdown(); |
---|
82 | |
---|
83 | // Set Pointer to null to destroy the objects before this function ends |
---|
84 | core = NULL; |
---|
85 | |
---|
86 | return 0; |
---|
87 | } |
---|