Panda3D
|
00001 //////////////////////////////////////////////////////////////////// 00002 // 00003 // PANDA 3D SOFTWARE 00004 // Copyright (c) Carnegie Mellon University. All rights reserved. 00005 // 00006 // All use of this software is subject to the terms of the revised BSD 00007 // license. You should have received a copy of this license along 00008 // with this source code in a file named "LICENSE." 00009 // 00010 //////////////////////////////////////////////////////////////////// 00011 #include <Carbon/Carbon.h> 00012 00013 #include "config_osxdisplay.h" 00014 #include "osxGraphicsBuffer.h" 00015 #include "osxGraphicsPipe.h" 00016 #include "osxGraphicsStateGuardian.h" 00017 #include "osxGraphicsWindow.h" 00018 00019 #include "graphicsPipeSelection.h" 00020 #include "dconfig.h" 00021 #include "pandaSystem.h" 00022 00023 00024 Configure(config_osxdisplay); 00025 00026 NotifyCategoryDef(osxdisplay, "display"); 00027 00028 ConfigureFn(config_osxdisplay) { 00029 init_libosxdisplay(); 00030 } 00031 00032 ConfigVariableBool show_resize_box 00033 ("show-resize-box", true, 00034 PRC_DESC("When this variable is true, then resizable OSX Panda windows will " 00035 "be rendered with a resize control in the lower-right corner. " 00036 "This is specially handled by Panda, since otherwise the 3-d " 00037 "window would completely hide any resize control drawn by the " 00038 "OS. Set this variable false to allow this control to be hidden.")); 00039 00040 ConfigVariableBool osx_support_gl_buffer 00041 ("osx-support-gl-buffer", true, 00042 PRC_DESC("Set this true to support use of GLBuffers on OSX. This is false by " 00043 "default because there appear to be some prevalent driver issues with GLBuffers " 00044 "that cause program crashes. Offscreen buffers can still be created as " 00045 "AGLPbuffers, if supported by the driver.")); 00046 00047 ConfigVariableBool osx_disable_event_loop 00048 ("osx-disable-event-loop", false, 00049 PRC_DESC("Set this true to disable the window event loop for the Panda " 00050 "windows. This makes sense only in a publish environment where " 00051 "the window event loop is already handled by another part of the " 00052 "app.")); 00053 00054 ConfigVariableInt osx_mouse_wheel_scale 00055 ("osx-mouse-wheel-scale", 1, 00056 PRC_DESC("Specify the number of units to spin the Mac mouse wheel to " 00057 "represent a single wheel_up or wheel_down message.")); 00058 00059 //////////////////////////////////////////////////////////////////// 00060 // Function: init_libosxdisplay 00061 // Description: Initializes the library. This must be called at 00062 // least once before any of the functions or classes in 00063 // this library can be used. Normally it will be 00064 // called by the static initializers and need not be 00065 // called explicitly, but special cases exist. 00066 //////////////////////////////////////////////////////////////////// 00067 void 00068 init_libosxdisplay() { 00069 static bool initialized = false; 00070 if (initialized) { 00071 return; 00072 } 00073 initialized = true; 00074 00075 osxGraphicsBuffer::init_type(); 00076 osxGraphicsPipe::init_type(); 00077 osxGraphicsWindow::init_type(); 00078 osxGraphicsStateGuardian::init_type(); 00079 00080 GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); 00081 selection->add_pipe_type(osxGraphicsPipe::get_class_type(), osxGraphicsPipe::pipe_constructor); 00082 00083 PandaSystem *ps = PandaSystem::get_global_ptr(); 00084 ps->set_system_tag("OpenGL", "window_system", "OSX"); 00085 }