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. When true, there is a risk of " 00043 "a program crash due to buggy driver support for GLBuffers. " 00044 "If this is false, offscreen buffers will be created as " 00045 "AGLPbuffers, which are less powerful, and appear to have their " 00046 "own set of problems.")); 00047 00048 ConfigVariableBool osx_disable_event_loop 00049 ("osx-disable-event-loop", false, 00050 PRC_DESC("Set this true to disable the window event loop for the Panda " 00051 "windows. This makes sense only in a publish environment where " 00052 "the window event loop is already handled by another part of the " 00053 "app.")); 00054 00055 ConfigVariableInt osx_mouse_wheel_scale 00056 ("osx-mouse-wheel-scale", 1, 00057 PRC_DESC("Specify the number of units to spin the Mac mouse wheel to " 00058 "represent a single wheel_up or wheel_down message.")); 00059 00060 //////////////////////////////////////////////////////////////////// 00061 // Function: init_libosxdisplay 00062 // Description: Initializes the library. This must be called at 00063 // least once before any of the functions or classes in 00064 // this library can be used. Normally it will be 00065 // called by the static initializers and need not be 00066 // called explicitly, but special cases exist. 00067 //////////////////////////////////////////////////////////////////// 00068 void 00069 init_libosxdisplay() { 00070 static bool initialized = false; 00071 if (initialized) { 00072 return; 00073 } 00074 initialized = true; 00075 00076 osxGraphicsBuffer::init_type(); 00077 osxGraphicsPipe::init_type(); 00078 osxGraphicsWindow::init_type(); 00079 osxGraphicsStateGuardian::init_type(); 00080 00081 GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr(); 00082 selection->add_pipe_type(osxGraphicsPipe::get_class_type(), osxGraphicsPipe::pipe_constructor); 00083 00084 PandaSystem *ps = PandaSystem::get_global_ptr(); 00085 ps->set_system_tag("OpenGL", "window_system", "OSX"); 00086 }