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 "eglGraphicsPipe.h"
16 #include "eglGraphicsWindow.h"
18 #include "graphicsPipeSelection.h"
19 #include "dconfig.h"
20 #include "pandaSystem.h"
21 
22 #if !defined(CPPPARSER) && !defined(LINK_ALL_STATIC) && !defined(BUILDING_PANDAGLES) && !defined(BUILDING_PANDAGLES2)
23  #error Buildsystem error: BUILDING_PANDAGLES(2) not defined
24 #endif
25 
26 Configure(config_egldisplay);
27 NotifyCategoryDef(egldisplay, "display");
28 
29 ConfigureFn(config_egldisplay) {
31 }
32 
33 /**
34  * Initializes the library. This must be called at least once before any of
35  * the functions or classes in this library can be used. Normally it will be
36  * called by the static initializers and need not be called explicitly, but
37  * special cases exist.
38  */
39 void
41  static bool initialized = false;
42  if (initialized) {
43  return;
44  }
45  initialized = true;
46 
47  eglGraphicsPipe::init_type();
48  eglGraphicsWindow::init_type();
49  eglGraphicsStateGuardian::init_type();
50 
52  selection->add_pipe_type(eglGraphicsPipe::get_class_type(),
53  eglGraphicsPipe::pipe_constructor);
54 
56 #ifdef OPENGLES_2
57  ps->set_system_tag("OpenGL ES 2", "window_system", "EGL");
58 #else
59  ps->set_system_tag("OpenGL ES", "window_system", "EGL");
60 #endif
61 }
62 
63 /**
64  * Returns the given EGL error as string.
65  */
66 const std::string get_egl_error_string(int error) {
67  switch (error) {
68  case 0x3000: return "EGL_SUCCESS"; break;
69  case 0x3001: return "EGL_NOT_INITIALIZED"; break;
70  case 0x3002: return "EGL_BAD_ACCESS"; break;
71  case 0x3003: return "EGL_BAD_ALLOC"; break;
72  case 0x3004: return "EGL_BAD_ATTRIBUTE"; break;
73  case 0x3005: return "EGL_BAD_CONFIG"; break;
74  case 0x3006: return "EGL_BAD_CONTEXT"; break;
75  case 0x3007: return "EGL_BAD_CURRENT_SURFACE"; break;
76  case 0x3008: return "EGL_BAD_DISPLAY"; break;
77  case 0x3009: return "EGL_BAD_MATCH"; break;
78  case 0x300A: return "EGL_BAD_NATIVE_PIXMAP"; break;
79  case 0x300B: return "EGL_BAD_NATIVE_WINDOW"; break;
80  case 0x300C: return "EGL_BAD_PARAMETER"; break;
81  case 0x300D: return "EGL_BAD_SURFACE"; break;
82  case 0x300E: return "EGL_CONTEXT_LOST"; break;
83  default: return "Unknown error";
84  }
85 }
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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:26
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
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.
const std::string get_egl_error_string(int error)
Returns the given EGL error as string.
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.
PANDA 3D SOFTWARE Copyright (c) Carnegie Mellon University.
bool add_pipe_type(TypeHandle type, PipeConstructorFunc *func)
Adds a new kind of GraphicsPipe to the list of available pipes for creation.
void init_libegldisplay()
Initializes the library.