Panda3D

config_osxdisplay.cxx
Go to the documentation of this file.
1 /**
2 * PANDA 3D SOFTWARE
3 * Copyright (c) Carnegie Mellon University. All rights reserved.
4 *
5 * All use of this software is subject to the terms of the revised BSD
6 * license. You should have received a copy of this license along
7 * with this source code in a file named "LICENSE."
8 *
9 * @file config_osxdisplay.cxx
10 */
11
12 #include "config_osxdisplay.h"
13 #include "osxGraphicsBuffer.h"
14 #include "osxGraphicsPipe.h"
15 #include "osxGraphicsStateGuardian.h"
16 #include "osxGraphicsWindow.h"
17
18 #include "graphicsPipeSelection.h"
19 #include "dconfig.h"
20 #include "pandaSystem.h"
21
22
23 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDA_OSXDISPLAY)
24 #error Buildsystem error: BUILDING_PANDA_OSXDISPLAY not defined
25 #endif
26
27 Configure(config_osxdisplay);
28
29 NotifyCategoryDef(osxdisplay, "display");
30
31 ConfigureFn(config_osxdisplay) {
32 init_libosxdisplay();
33 }
34
35 ConfigVariableBool show_resize_box
36 ("show-resize-box", true,
37 PRC_DESC("When this variable is true, then resizable OSX Panda windows will "
38 "be rendered with a resize control in the lower-right corner. "
39 "This is specially handled by Panda, since otherwise the 3-d "
40 "window would completely hide any resize control drawn by the "
41 "OS. Set this variable false to allow this control to be hidden."));
42
43 ConfigVariableBool osx_support_gl_buffer
44 ("osx-support-gl-buffer", true,
45 PRC_DESC("Set this true to support use of GLBuffers on OSX. When true, there is a risk of "
46 "a program crash due to buggy driver support for GLBuffers. "
47 "If this is false, offscreen buffers will be created as "
48 "AGLPbuffers, which are less powerful, and appear to have their "
49 "own set of problems."));
50
51 ConfigVariableBool osx_disable_event_loop
52 ("osx-disable-event-loop", false,
53 PRC_DESC("Set this true to disable the window event loop for the Panda "
54 "windows. This makes sense only in a publish environment where "
55 "the window event loop is already handled by another part of the "
56 "app."));
57
58 ConfigVariableInt osx_mouse_wheel_scale
59 ("osx-mouse-wheel-scale", 1,
60 PRC_DESC("Specify the number of units to spin the Mac mouse wheel to "
61 "represent a single wheel_up or wheel_down message."));
62
63 /**
64 * Initializes the library. This must be called at least once before any of
65 * the functions or classes in this library can be used. Normally it will be
66 * called by the static initializers and need not be called explicitly, but
67 * special cases exist.
68 */
69 void
70 init_libosxdisplay() {
71 static bool initialized = false;
72 if (initialized) {
73 return;
74 }
75 initialized = true;
76
77 osxGraphicsBuffer::init_type();
78 osxGraphicsPipe::init_type();
79 osxGraphicsWindow::init_type();
80 osxGraphicsStateGuardian::init_type();
81
82 GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
83 selection->add_pipe_type(osxGraphicsPipe::get_class_type(), osxGraphicsPipe::pipe_constructor);
84
85 PandaSystem *ps = PandaSystem::get_global_ptr();
86 ps->set_system_tag("OpenGL", "window_system", "OSX");
87 }
ConfigVariableBool
This is a convenience class to specialize ConfigVariable as a boolean type.
Definition: configVariableBool.h:23
ConfigVariableInt
This is a convenience class to specialize ConfigVariable as an integer type.
Definition: configVariableInt.h:24
GraphicsPipeSelection
This maintains a list of GraphicsPipes by type that are available for creation.
Definition: graphicsPipeSelection.h:33
GraphicsPipeSelection::get_global_ptr
static GraphicsPipeSelection * get_global_ptr()
Returns a pointer to the one global GraphicsPipeSelection object.
Definition: graphicsPipeSelection.I:28
GraphicsPipeSelection::add_pipe_type
bool add_pipe_type(TypeHandle type, PipeConstructorFunc *func)
Adds a new kind of GraphicsPipe to the list of available pipes for creation.
Definition: graphicsPipeSelection.cxx:317
PandaSystem
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:26
PandaSystem::set_system_tag
void set_system_tag(const std::string &system, const std::string &tag, const std::string &value)
Intended for use by each subsystem to register its set of capabilities at startup.
Definition: pandaSystem.cxx:381
PandaSystem::get_global_ptr
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
Definition: pandaSystem.cxx:446
init_libosxdisplay
void init_libosxdisplay()
Initializes the library.
Definition: config_osxdisplay.cxx:70
config_osxdisplay.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
dconfig.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
graphicsPipeSelection.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
osxGraphicsBuffer.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
osxGraphicsPipe.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
osxGraphicsStateGuardian.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
osxGraphicsWindow.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
pandaSystem.h
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.