Panda3D
config_egldisplay.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_egldisplay.cxx
10  * @author cary
11  * @date 1999-10-07
12  */
13 
14 #include "config_egldisplay.h"
15 #include "eglGraphicsBuffer.h"
16 #include "eglGraphicsPipe.h"
17 #include "eglGraphicsPixmap.h"
18 #include "eglGraphicsWindow.h"
20 #include "graphicsPipeSelection.h"
21 #include "dconfig.h"
22 #include "pandaSystem.h"
23 
24 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAGLES) && !defined(BUILDING_PANDAGLES2) && !defined(BUILDING_PANDAGL)
25  #error Buildsystem error: BUILDING_PANDAGL(ES(2)) not defined
26 #endif
27 
28 Configure(config_egldisplay);
29 NotifyCategoryDef(egldisplay, "display");
30 
31 ConfigureFn(config_egldisplay) {
33 }
34 
35 /**
36  * Initializes the library. This must be called at least once before any of
37  * the functions or classes in this library can be used. Normally it will be
38  * called by the static initializers and need not be called explicitly, but
39  * special cases exist.
40  */
41 void
43  static bool initialized = false;
44  if (initialized) {
45  return;
46  }
47  initialized = true;
48 
49  eglGraphicsBuffer::init_type();
50  eglGraphicsPipe::init_type();
51 #ifdef USE_X11
52  eglGraphicsPixmap::init_type();
53  eglGraphicsWindow::init_type();
54 #endif
55  eglGraphicsStateGuardian::init_type();
56 
58  selection->add_pipe_type(eglGraphicsPipe::get_class_type(),
59  eglGraphicsPipe::pipe_constructor);
60 
62 #ifdef OPENGLES_2
63  ps->set_system_tag("OpenGL ES 2", "window_system", "EGL");
64 #elif defined(OPENGLES_1)
65  ps->set_system_tag("OpenGL ES", "window_system", "EGL");
66 #else
67  ps->set_system_tag("OpenGL", "window_system", "EGL");
68 #endif
69 }
70 
71 /**
72  * Returns the given EGL error as string.
73  */
74 const std::string get_egl_error_string(int error) {
75  switch (error) {
76  case 0x3000: return "EGL_SUCCESS"; break;
77  case 0x3001: return "EGL_NOT_INITIALIZED"; break;
78  case 0x3002: return "EGL_BAD_ACCESS"; break;
79  case 0x3003: return "EGL_BAD_ALLOC"; break;
80  case 0x3004: return "EGL_BAD_ATTRIBUTE"; break;
81  case 0x3005: return "EGL_BAD_CONFIG"; break;
82  case 0x3006: return "EGL_BAD_CONTEXT"; break;
83  case 0x3007: return "EGL_BAD_CURRENT_SURFACE"; break;
84  case 0x3008: return "EGL_BAD_DISPLAY"; break;
85  case 0x3009: return "EGL_BAD_MATCH"; break;
86  case 0x300A: return "EGL_BAD_NATIVE_PIXMAP"; break;
87  case 0x300B: return "EGL_BAD_NATIVE_WINDOW"; break;
88  case 0x300C: return "EGL_BAD_PARAMETER"; break;
89  case 0x300D: return "EGL_BAD_SURFACE"; break;
90  case 0x300E: return "EGL_CONTEXT_LOST"; break;
91  default: return "Unknown error";
92  }
93 }
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 class is used as a namespace to group several global properties of Panda.
Definition: pandaSystem.h:26
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.
static PandaSystem * get_global_ptr()
Returns the global PandaSystem object.
void init_libegldisplay()
Initializes the library.
const std::string get_egl_error_string(int error)
Returns the given EGL error as string.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.