Panda3D
 All Classes Functions Variables Enumerations
config_egldisplay.cxx
00001 // Filename: config_egldisplay.cxx
00002 // Created by:  cary (07Oct99)
00003 //
00004 ////////////////////////////////////////////////////////////////////
00005 //
00006 // PANDA 3D SOFTWARE
00007 // Copyright (c) Carnegie Mellon University.  All rights reserved.
00008 //
00009 // All use of this software is subject to the terms of the revised BSD
00010 // license.  You should have received a copy of this license along
00011 // with this source code in a file named "LICENSE."
00012 //
00013 ////////////////////////////////////////////////////////////////////
00014 
00015 #include "config_egldisplay.h"
00016 #include "eglGraphicsPipe.h"
00017 #include "eglGraphicsWindow.h"
00018 #include "eglGraphicsStateGuardian.h"
00019 #include "graphicsPipeSelection.h"
00020 #include "dconfig.h"
00021 #include "pandaSystem.h"
00022 
00023 Configure(config_egldisplay);
00024 NotifyCategoryDef(egldisplay, "display");
00025 
00026 ConfigureFn(config_egldisplay) {
00027   init_libegldisplay();
00028 }
00029 
00030 ConfigVariableString display_cfg
00031 ("display", "",
00032  PRC_DESC("Specify the X display string for the default display.  If this "
00033           "is not specified, $DISPLAY is used."));
00034 
00035 ConfigVariableBool x_error_abort
00036 ("x-error-abort", false,
00037  PRC_DESC("Set this true to trigger and abort (and a stack trace) on receipt "
00038           "of an error from the X window system.  This can make it easier "
00039           "to discover where these errors are generated."));
00040 
00041 ConfigVariableInt x_wheel_up_button
00042 ("x-wheel-up-button", 4,
00043  PRC_DESC("This is the mouse button index of the wheel_up event: which "
00044           "mouse button number does the system report when the mouse wheel "
00045           "is rolled one notch up?"));
00046 
00047 ConfigVariableInt x_wheel_down_button
00048 ("x-wheel-down-button", 5,
00049  PRC_DESC("This is the mouse button index of the wheel_down event: which "
00050           "mouse button number does the system report when the mouse wheel "
00051           "is rolled one notch down?"));
00052 
00053 ConfigVariableInt x_wheel_left_button
00054 ("x-wheel-left-button", 6,
00055  PRC_DESC("This is the mouse button index of the wheel_left event: which "
00056           "mouse button number does the system report when one scrolls "
00057           "to the left?"));
00058 
00059 ConfigVariableInt x_wheel_right_button
00060 ("x-wheel-right-button", 7,
00061  PRC_DESC("This is the mouse button index of the wheel_right event: which "
00062           "mouse button number does the system report when one scrolls "
00063           "to the right?"));
00064 
00065 ////////////////////////////////////////////////////////////////////
00066 //     Function: init_libegldisplay
00067 //  Description: Initializes the library.  This must be called at
00068 //               least once before any of the functions or classes in
00069 //               this library can be used.  Normally it will be
00070 //               called by the static initializers and need not be
00071 //               called explicitly, but special cases exist.
00072 ////////////////////////////////////////////////////////////////////
00073 void
00074 init_libegldisplay() {
00075   static bool initialized = false;
00076   if (initialized) {
00077     return;
00078   }
00079   initialized = true;
00080 
00081   eglGraphicsPipe::init_type();
00082   eglGraphicsWindow::init_type();
00083   eglGraphicsStateGuardian::init_type();
00084 
00085   GraphicsPipeSelection *selection = GraphicsPipeSelection::get_global_ptr();
00086   selection->add_pipe_type(eglGraphicsPipe::get_class_type(),
00087                            eglGraphicsPipe::pipe_constructor);
00088 
00089   PandaSystem *ps = PandaSystem::get_global_ptr();
00090 #ifdef OPENGLES_2
00091   ps->set_system_tag("OpenGL ES 2", "window_system", "EGL");
00092 #else
00093   ps->set_system_tag("OpenGL ES", "window_system", "EGL");
00094 #endif
00095 }
00096 
00097 ////////////////////////////////////////////////////////////////////
00098 //     Function: get_egl_error_string
00099 //  Description: Returns the given EGL error as string.
00100 ////////////////////////////////////////////////////////////////////
00101 const string get_egl_error_string(int error) {
00102   switch (error) {
00103     case 0x3000: return "EGL_SUCCESS"; break;
00104     case 0x3001: return "EGL_NOT_INITIALIZED"; break;
00105     case 0x3002: return "EGL_BAD_ACCESS"; break;
00106     case 0x3003: return "EGL_BAD_ALLOC"; break;
00107     case 0x3004: return "EGL_BAD_ATTRIBUTE"; break;
00108     case 0x3005: return "EGL_BAD_CONFIG"; break;
00109     case 0x3006: return "EGL_BAD_CONTEXT"; break;
00110     case 0x3007: return "EGL_BAD_CURRENT_SURFACE"; break;
00111     case 0x3008: return "EGL_BAD_DISPLAY"; break;
00112     case 0x3009: return "EGL_BAD_MATCH"; break;
00113     case 0x300A: return "EGL_BAD_NATIVE_PIXMAP"; break;
00114     case 0x300B: return "EGL_BAD_NATIVE_WINDOW"; break;
00115     case 0x300C: return "EGL_BAD_PARAMETER"; break;
00116     case 0x300D: return "EGL_BAD_SURFACE"; break;
00117     case 0x300E: return "EGL_CONTEXT_LOST"; break;
00118     default: return "Unknown error";
00119   }
00120 }
 All Classes Functions Variables Enumerations