oculus1

annotate libovr/Src/Kernel/OVR_System.h @ 29:9a973ef0e2a3

fixed the performance issue under MacOSX by replacing glutSolidTeapot (which uses glEvalMesh) with my own teapot generator.
author John Tsiombikas <nuclear@member.fsf.org>
date Sun, 27 Oct 2013 06:31:18 +0200
parents e2f9e4603129
children
rev   line source
nuclear@3 1 /************************************************************************************
nuclear@3 2
nuclear@3 3 PublicHeader: OVR
nuclear@3 4 Filename : OVR_System.h
nuclear@3 5 Content : General kernel initialization/cleanup, including that
nuclear@3 6 of the memory allocator.
nuclear@3 7 Created : September 19, 2012
nuclear@3 8 Notes :
nuclear@3 9
nuclear@3 10 Copyright : Copyright 2012 Oculus VR, Inc. All Rights reserved.
nuclear@3 11
nuclear@3 12 Use of this software is subject to the terms of the Oculus license
nuclear@3 13 agreement provided at the time of installation or download, or which
nuclear@3 14 otherwise accompanies this software in either electronic or hard copy form.
nuclear@3 15
nuclear@3 16 ************************************************************************************/
nuclear@3 17
nuclear@3 18 #ifndef OVR_System_h
nuclear@3 19 #define OVR_System_h
nuclear@3 20
nuclear@3 21 #include "OVR_Allocator.h"
nuclear@3 22 #include "OVR_Log.h"
nuclear@3 23
nuclear@3 24 namespace OVR {
nuclear@3 25
nuclear@3 26 // ***** System Core Initialization class
nuclear@3 27
nuclear@3 28 // System initialization must take place before any other OVR_Kernel objects are used;
nuclear@3 29 // this is done my calling System::Init(). Among other things, this is necessary to
nuclear@3 30 // initialize the memory allocator. Similarly, System::Destroy must be
nuclear@3 31 // called before program exist for proper cleanup. Both of these tasks can be achieved by
nuclear@3 32 // simply creating System object first, allowing its constructor/destructor do the work.
nuclear@3 33
nuclear@3 34 // TBD: Require additional System class for Oculus Rift API?
nuclear@3 35
nuclear@3 36 class System
nuclear@3 37 {
nuclear@3 38 public:
nuclear@3 39
nuclear@3 40 // System constructor expects allocator to be specified, if it is being substituted.
nuclear@3 41 System(Log* log = Log::ConfigureDefaultLog(LogMask_Debug),
nuclear@3 42 Allocator* palloc = DefaultAllocator::InitSystemSingleton())
nuclear@3 43 {
nuclear@3 44 Init(log, palloc);
nuclear@3 45 }
nuclear@3 46
nuclear@3 47 ~System()
nuclear@3 48 {
nuclear@3 49 Destroy();
nuclear@3 50 }
nuclear@3 51
nuclear@3 52 // Returns 'true' if system was properly initialized.
nuclear@3 53 static bool OVR_CDECL IsInitialized();
nuclear@3 54
nuclear@3 55 // Initializes System core. Users can override memory implementation by passing
nuclear@3 56 // a different Allocator here.
nuclear@3 57 static void OVR_CDECL Init(Log* log = Log::ConfigureDefaultLog(LogMask_Debug),
nuclear@3 58 Allocator *palloc = DefaultAllocator::InitSystemSingleton());
nuclear@3 59
nuclear@3 60 // De-initializes System more, finalizing the threading system and destroying
nuclear@3 61 // the global memory allocator.
nuclear@3 62 static void OVR_CDECL Destroy();
nuclear@3 63 };
nuclear@3 64
nuclear@3 65 } // OVR
nuclear@3 66
nuclear@3 67 #endif