pandagl.cxx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192
  1. /**
  2. * @file pandagl.cxx
  3. * @author drose
  4. * @date 2000-05-15
  5. */
  6. #include "pandagl.h"
  7. #include "config_glgsg.h"
  8. #ifdef HAVE_WGL
  9. #include "config_wgldisplay.h"
  10. #include "wglGraphicsPipe.h"
  11. #endif
  12. #ifdef HAVE_COCOA
  13. #include "config_cocoagldisplay.h"
  14. #include "cocoaGLGraphicsPipe.h"
  15. #endif
  16. #ifdef HAVE_GLX
  17. #include "config_glxdisplay.h"
  18. #include "glxGraphicsPipe.h"
  19. #endif
  20. #ifdef HAVE_EGL
  21. #include "config_egldisplay.h"
  22. #include "eglGraphicsPipe.h"
  23. #endif
  24. #if !defined(HAVE_WGL) && !defined(HAVE_COCOA) && !defined(HAVE_GLX) && !defined(HAVE_EGL)
  25. #error One of HAVE_WGL, HAVE_COCOA, HAVE_GLX or HAVE_EGL must be defined when compiling pandagl!
  26. #endif
  27. /**
  28. * Initializes the library. This must be called at least once before any of
  29. * the functions or classes in this library can be used. Normally it will be
  30. * called by the static initializers and need not be called explicitly, but
  31. * special cases exist.
  32. */
  33. void
  34. init_libpandagl() {
  35. init_libglgsg();
  36. #ifdef HAVE_WGL
  37. init_libwgldisplay();
  38. #endif // HAVE_GL
  39. #ifdef HAVE_COCOA
  40. init_libcocoagldisplay();
  41. #endif
  42. #ifdef HAVE_GLX
  43. init_libglxdisplay();
  44. #endif
  45. #ifdef HAVE_EGL
  46. init_libegldisplay();
  47. #endif
  48. }
  49. /**
  50. * Returns the TypeHandle index of the recommended graphics pipe type defined
  51. * by this module.
  52. */
  53. int
  54. get_pipe_type_pandagl() {
  55. #ifdef HAVE_WGL
  56. return wglGraphicsPipe::get_class_type().get_index();
  57. #endif
  58. #ifdef HAVE_COCOA
  59. return CocoaGLGraphicsPipe::get_class_type().get_index();
  60. #endif
  61. #ifdef HAVE_GLX
  62. return glxGraphicsPipe::get_class_type().get_index();
  63. #endif
  64. #ifdef HAVE_EGL
  65. return eglGraphicsPipe::get_class_type().get_index();
  66. #endif
  67. return 0;
  68. }
  69. #if defined(HAVE_EGL) && !defined(USE_X11)
  70. int
  71. get_pipe_type_p3headlessgl() {
  72. return eglGraphicsPipe::get_class_type().get_index();
  73. }
  74. #endif