2
0

context_gl_x11.h 3.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. /*************************************************************************/
  2. /* context_gl_x11.h */
  3. /*************************************************************************/
  4. /* This file is part of: */
  5. /* GODOT ENGINE */
  6. /* https://godotengine.org */
  7. /*************************************************************************/
  8. /* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */
  9. /* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */
  10. /* */
  11. /* Permission is hereby granted, free of charge, to any person obtaining */
  12. /* a copy of this software and associated documentation files (the */
  13. /* "Software"), to deal in the Software without restriction, including */
  14. /* without limitation the rights to use, copy, modify, merge, publish, */
  15. /* distribute, sublicense, and/or sell copies of the Software, and to */
  16. /* permit persons to whom the Software is furnished to do so, subject to */
  17. /* the following conditions: */
  18. /* */
  19. /* The above copyright notice and this permission notice shall be */
  20. /* included in all copies or substantial portions of the Software. */
  21. /* */
  22. /* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
  23. /* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
  24. /* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
  25. /* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
  26. /* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
  27. /* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
  28. /* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
  29. /*************************************************************************/
  30. #ifndef CONTEXT_GL_X11_H
  31. #define CONTEXT_GL_X11_H
  32. /**
  33. @author Juan Linietsky <[email protected]>
  34. */
  35. #ifdef X11_ENABLED
  36. #if defined(OPENGL_ENABLED)
  37. #include "core/os/os.h"
  38. #include "drivers/gl_context/context_gl.h"
  39. #include <X11/Xlib.h>
  40. #include <X11/extensions/Xrender.h>
  41. struct ContextGL_X11_Private;
  42. class ContextGL_X11 : public ContextGL {
  43. public:
  44. enum ContextType {
  45. OLDSTYLE,
  46. GLES_2_0_COMPATIBLE,
  47. GLES_3_0_COMPATIBLE
  48. };
  49. private:
  50. ContextGL_X11_Private *p;
  51. OS::VideoMode default_video_mode;
  52. //::Colormap x11_colormap;
  53. ::Display *x11_display;
  54. ::Window &x11_window;
  55. bool double_buffer;
  56. bool direct_render;
  57. int glx_minor, glx_major;
  58. bool use_vsync;
  59. ContextType context_type;
  60. public:
  61. virtual void release_current();
  62. virtual void make_current();
  63. virtual void swap_buffers();
  64. virtual int get_window_width();
  65. virtual int get_window_height();
  66. virtual Error initialize();
  67. virtual void set_use_vsync(bool p_use);
  68. virtual bool is_using_vsync() const;
  69. ContextGL_X11(::Display *p_x11_display, ::Window &p_x11_window, const OS::VideoMode &p_default_video_mode, ContextType p_context_type);
  70. virtual ~ContextGL_X11();
  71. };
  72. #endif
  73. #endif
  74. #endif