Panda3D
 All Classes Functions Variables Enumerations
config_egldisplay.cxx
1 // Filename: config_egldisplay.cxx
2 // Created by: cary (07Oct99)
3 //
4 ////////////////////////////////////////////////////////////////////
5 //
6 // PANDA 3D SOFTWARE
7 // Copyright (c) Carnegie Mellon University. All rights reserved.
8 //
9 // All use of this software is subject to the terms of the revised BSD
10 // license. You should have received a copy of this license along
11 // with this source code in a file named "LICENSE."
12 //
13 ////////////////////////////////////////////////////////////////////
14 
15 #include "config_egldisplay.h"
16 #include "eglGraphicsPipe.h"
17 #include "eglGraphicsWindow.h"
18 #include "eglGraphicsStateGuardian.h"
19 #include "graphicsPipeSelection.h"
20 #include "dconfig.h"
21 #include "pandaSystem.h"
22 
23 Configure(config_egldisplay);
24 NotifyCategoryDef(egldisplay, "display");
25 
26 ConfigureFn(config_egldisplay) {
27  init_libegldisplay();
28 }
29 
30 ConfigVariableString display_cfg
31 ("display", "",
32  PRC_DESC("Specify the X display string for the default display. If this "
33  "is not specified, $DISPLAY is used."));
34 
35 ConfigVariableBool x_error_abort
36 ("x-error-abort", false,
37  PRC_DESC("Set this true to trigger and abort (and a stack trace) on receipt "
38  "of an error from the X window system. This can make it easier "
39  "to discover where these errors are generated."));
40 
41 ConfigVariableInt x_wheel_up_button
42 ("x-wheel-up-button", 4,
43  PRC_DESC("This is the mouse button index of the wheel_up event: which "
44  "mouse button number does the system report when the mouse wheel "
45  "is rolled one notch up?"));
46 
47 ConfigVariableInt x_wheel_down_button
48 ("x-wheel-down-button", 5,
49  PRC_DESC("This is the mouse button index of the wheel_down event: which "
50  "mouse button number does the system report when the mouse wheel "
51  "is rolled one notch down?"));
52 
53 ConfigVariableInt x_wheel_left_button
54 ("x-wheel-left-button", 6,
55  PRC_DESC("This is the mouse button index of the wheel_left event: which "
56  "mouse button number does the system report when one scrolls "
57  "to the left?"));
58 
59 ConfigVariableInt x_wheel_right_button
60 ("x-wheel-right-button", 7,
61  PRC_DESC("This is the mouse button index of the wheel_right event: which "
62  "mouse button number does the system report when one scrolls "
63  "to the right?"));
64 
65 ////////////////////////////////////////////////////////////////////
66 // Function: init_libegldisplay
67 // Description: Initializes the library. This must be called at
68 // least once before any of the functions or classes in
69 // this library can be used. Normally it will be
70 // called by the static initializers and need not be
71 // called explicitly, but special cases exist.
72 ////////////////////////////////////////////////////////////////////
73 void
74 init_libegldisplay() {
75  static bool initialized = false;
76  if (initialized) {
77  return;
78  }
79  initialized = true;
80 
81  eglGraphicsPipe::init_type();
82  eglGraphicsWindow::init_type();
83  eglGraphicsStateGuardian::init_type();
84 
86  selection->add_pipe_type(eglGraphicsPipe::get_class_type(),
87  eglGraphicsPipe::pipe_constructor);
88 
90 #ifdef OPENGLES_2
91  ps->set_system_tag("OpenGL ES 2", "window_system", "EGL");
92 #else
93  ps->set_system_tag("OpenGL ES", "window_system", "EGL");
94 #endif
95 }
96 
97 ////////////////////////////////////////////////////////////////////
98 // Function: get_egl_error_string
99 // Description: Returns the given EGL error as string.
100 ////////////////////////////////////////////////////////////////////
101 const string get_egl_error_string(int error) {
102  switch (error) {
103  case 0x3000: return "EGL_SUCCESS"; break;
104  case 0x3001: return "EGL_NOT_INITIALIZED"; break;
105  case 0x3002: return "EGL_BAD_ACCESS"; break;
106  case 0x3003: return "EGL_BAD_ALLOC"; break;
107  case 0x3004: return "EGL_BAD_ATTRIBUTE"; break;
108  case 0x3005: return "EGL_BAD_CONFIG"; break;
109  case 0x3006: return "EGL_BAD_CONTEXT"; break;
110  case 0x3007: return "EGL_BAD_CURRENT_SURFACE"; break;
111  case 0x3008: return "EGL_BAD_DISPLAY"; break;
112  case 0x3009: return "EGL_BAD_MATCH"; break;
113  case 0x300A: return "EGL_BAD_NATIVE_PIXMAP"; break;
114  case 0x300B: return "EGL_BAD_NATIVE_WINDOW"; break;
115  case 0x300C: return "EGL_BAD_PARAMETER"; break;
116  case 0x300D: return "EGL_BAD_SURFACE"; break;
117  case 0x300E: return "EGL_CONTEXT_LOST"; break;
118  default: return "Unknown error";
119  }
120 }
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
This class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:29
This is a convenience class to specialize ConfigVariable as a boolean type.
This is a convenience class to specialize ConfigVariable as a string type.
This maintains a list of GraphicsPipes by type that are available for creation.
static GraphicsPipeSelection * get_global_ptr()
Returns a pointer to the one global GraphicsPipeSelection object.
bool add_pipe_type(TypeHandle type, PipeConstructorFunc *func)
Adds a new kind of GraphicsPipe to the list of available pipes for creation.
This is a convenience class to specialize ConfigVariable as an integer type.
void set_system_tag(const string &system, const string &tag, const string &value)
Intended for use by each subsystem to register its set of capabilities at startup.