Panda3D
config_androiddisplay.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_androiddisplay.cxx
10  * @author rdb
11  * @date 2013-01-11
12  */
13 
14 #include "config_androiddisplay.h"
15 #include "androidGraphicsPipe.h"
16 #include "androidGraphicsWindow.h"
18 #include "graphicsPipeSelection.h"
19 #include "dconfig.h"
20 #include "pandaSystem.h"
21 
22 #include "config_display.h"
23 
24 Configure(config_androiddisplay);
25 NotifyCategoryDef(androiddisplay, "display");
26 
27 ConfigureFn(config_androiddisplay) {
29 }
30 
31 /**
32  * Initializes the library. This must be called at least once before any of
33  * the functions or classes in this library can be used. Normally it will be
34  * called by the static initializers and need not be called explicitly, but
35  * special cases exist.
36  */
37 void
39  static bool initialized = false;
40  if (initialized) {
41  return;
42  }
43  initialized = true;
44 
46  display_cat.get_safe_ptr();
47 
48  AndroidGraphicsPipe::init_type();
49  AndroidGraphicsWindow::init_type();
50  AndroidGraphicsStateGuardian::init_type();
51 
53  selection->add_pipe_type(AndroidGraphicsPipe::get_class_type(),
54  AndroidGraphicsPipe::pipe_constructor);
55 
57 #ifdef OPENGLES_2
58  ps->set_system_tag("OpenGL ES 2", "window_system", "Android");
59 #else
60  ps->set_system_tag("OpenGL ES", "window_system", "Android");
61 #endif
62 }
63 
64 /**
65  * Returns the given EGL error as string.
66  */
67 const std::string get_egl_error_string(int error) {
68  switch (error) {
69  case 0x3000: return "EGL_SUCCESS"; break;
70  case 0x3001: return "EGL_NOT_INITIALIZED"; break;
71  case 0x3002: return "EGL_BAD_ACCESS"; break;
72  case 0x3003: return "EGL_BAD_ALLOC"; break;
73  case 0x3004: return "EGL_BAD_ATTRIBUTE"; break;
74  case 0x3005: return "EGL_BAD_CONFIG"; break;
75  case 0x3006: return "EGL_BAD_CONTEXT"; break;
76  case 0x3007: return "EGL_BAD_CURRENT_SURFACE"; break;
77  case 0x3008: return "EGL_BAD_DISPLAY"; break;
78  case 0x3009: return "EGL_BAD_MATCH"; break;
79  case 0x300A: return "EGL_BAD_NATIVE_PIXMAP"; break;
80  case 0x300B: return "EGL_BAD_NATIVE_WINDOW"; break;
81  case 0x300C: return "EGL_BAD_PARAMETER"; break;
82  case 0x300D: return "EGL_BAD_SURFACE"; break;
83  case 0x300E: return "EGL_CONTEXT_LOST"; break;
84  default: return "Unknown error";
85  }
86 }
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.
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_libandroiddisplay()
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.
void init_libdisplay()
Initializes the library.
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.