androidGraphicsPipe.h 2.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990
  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 androidGraphicsPipe.h
  10. * @author rdb
  11. * @date 2013-01-11
  12. */
  13. #ifndef ANDROIDGRAPHICSPIPE_H
  14. #define ANDROIDGRAPHICSPIPE_H
  15. #include "pandabase.h"
  16. #include "graphicsWindow.h"
  17. #include "graphicsPipe.h"
  18. #ifdef OPENGLES_2
  19. #include "gles2gsg.h"
  20. // #define NativeDisplayType EGLNativeDisplayType #define NativePixmapType
  21. // EGLNativePixmapType #define NativeWindowType EGLNativeWindowType
  22. #else
  23. #include "glesgsg.h"
  24. #endif
  25. #include <EGL/egl.h>
  26. class FrameBufferProperties;
  27. class AndroidGraphicsBuffer;
  28. class AndroidGraphicsPixmap;
  29. class AndroidGraphicsWindow;
  30. /**
  31. * This graphics pipe represents the interface for creating OpenGL ES graphics
  32. * windows on an X-based (e.g. Unix) client.
  33. */
  34. class AndroidGraphicsPipe : public GraphicsPipe {
  35. public:
  36. AndroidGraphicsPipe();
  37. virtual ~AndroidGraphicsPipe();
  38. virtual std::string get_interface_name() const;
  39. static PT(GraphicsPipe) pipe_constructor();
  40. public:
  41. virtual PreferredWindowThread get_preferred_window_thread() const;
  42. protected:
  43. virtual PT(GraphicsOutput) make_output(const std::string &name,
  44. const FrameBufferProperties &fb_prop,
  45. const WindowProperties &win_prop,
  46. int flags,
  47. GraphicsEngine *engine,
  48. GraphicsStateGuardian *gsg,
  49. GraphicsOutput *host,
  50. int retry,
  51. bool &precertify);
  52. private:
  53. EGLDisplay _egl_display;
  54. GraphicsWindow *_window;
  55. public:
  56. static TypeHandle get_class_type() {
  57. return _type_handle;
  58. }
  59. static void init_type() {
  60. GraphicsPipe::init_type();
  61. register_type(_type_handle, "AndroidGraphicsPipe",
  62. GraphicsPipe::get_class_type());
  63. }
  64. virtual TypeHandle get_type() const {
  65. return get_class_type();
  66. }
  67. virtual TypeHandle force_init_type() {init_type(); return get_class_type();}
  68. private:
  69. static TypeHandle _type_handle;
  70. friend class AndroidGraphicsBuffer;
  71. friend class AndroidGraphicsPixmap;
  72. friend class AndroidGraphicsWindow;
  73. };
  74. #include "androidGraphicsPipe.I"
  75. #endif