[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 | |
---|
[86] | 17 | // Declare this in header. |
---|
| 18 | //#include <windows.h> |
---|
| 19 | #define _CRTDBG_MAP_ALLOC |
---|
| 20 | #include <crtdbg.h> |
---|
| 21 | |
---|
[31] | 22 | #include <osg/ArgumentParser> |
---|
| 23 | #include <osg/Referenced> |
---|
| 24 | #include <osgDB/Registry> |
---|
| 25 | |
---|
| 26 | #include <visual_core.h> |
---|
| 27 | |
---|
| 28 | const unsigned int MAX_NUM_EVENTS = 10; |
---|
| 29 | |
---|
[86] | 30 | |
---|
[31] | 31 | int main(int argc, char** argv) |
---|
| 32 | { |
---|
[86] | 33 | |
---|
| 34 | #ifdef _DEBUG |
---|
| 35 | #include <leakDetection.h> // ugly but must be included inside the class |
---|
| 36 | |
---|
| 37 | int tmp_flag; |
---|
| 38 | |
---|
| 39 | HANDLE log_file = CreateFile("mem_log.txt", GENERIC_WRITE,FILE_SHARE_WRITE, |
---|
| 40 | NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); |
---|
| 41 | |
---|
| 42 | _CrtSetReportMode(_CRT_ASSERT,_CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | |
---|
| 43 | _CRTDBG_MODE_DEBUG); |
---|
| 44 | _CrtSetReportMode(_CRT_WARN,_CRTDBG_MODE_FILE | _CRTDBG_MODE_DEBUG); |
---|
| 45 | _CrtSetReportMode(_CRT_ERROR,_CRTDBG_MODE_FILE | _CRTDBG_MODE_WNDW | |
---|
| 46 | _CRTDBG_MODE_DEBUG); |
---|
| 47 | |
---|
| 48 | // output to the file if not under VS |
---|
| 49 | _CrtSetReportFile(_CRT_ASSERT, log_file); |
---|
| 50 | _CrtSetReportFile(_CRT_WARN, log_file); |
---|
| 51 | _CrtSetReportFile(_CRT_ERROR, log_file); |
---|
| 52 | |
---|
| 53 | tmp_flag = _CrtSetDbgFlag(_CRTDBG_REPORT_FLAG); |
---|
| 54 | tmp_flag |= _CRTDBG_ALLOC_MEM_DF; |
---|
| 55 | tmp_flag |= _CRTDBG_DELAY_FREE_MEM_DF; |
---|
| 56 | tmp_flag |= _CRTDBG_LEAK_CHECK_DF; |
---|
| 57 | |
---|
| 58 | _CrtSetDbgFlag(tmp_flag); |
---|
| 59 | #endif |
---|
| 60 | |
---|
[31] | 61 | // Use an ArgumentParser object to manage the program arguments. |
---|
| 62 | osg::ArgumentParser arguments(&argc,argv); |
---|
| 63 | |
---|
| 64 | // Instantiate osgVisual main class |
---|
| 65 | osg::ref_ptr<osgVisual::visual_core> core = new osgVisual::visual_core(arguments); |
---|
| 66 | |
---|
| 67 | // Visual initialisieren |
---|
| 68 | core->initialize(); |
---|
| 69 | |
---|
[86] | 70 | // Set Pointer to null to destroy the objects before this function ends - otherwise memory leaks wil be detected. |
---|
| 71 | core = NULL; |
---|
| 72 | |
---|
[31] | 73 | return 0; |
---|
[86] | 74 | } |
---|