glcontext_glx.h 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. /*
  2. * Copyright 2011-2019 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
  6. #define BGFX_GLCONTEXT_GLX_H_HEADER_GUARD
  7. #if BGFX_USE_GLX
  8. # include <X11/Xlib.h>
  9. # include <GL/glx.h>
  10. namespace bgfx { namespace gl
  11. {
  12. struct SwapChainGL;
  13. struct GlContext
  14. {
  15. GlContext()
  16. : m_current(NULL)
  17. , m_context(0)
  18. , m_visualInfo(NULL)
  19. , m_display(NULL)
  20. {
  21. }
  22. void create(uint32_t _width, uint32_t _height);
  23. void destroy();
  24. void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
  25. uint64_t getCaps() const;
  26. SwapChainGL* createSwapChain(void* _nwh);
  27. void destroySwapChain(SwapChainGL* _swapChain);
  28. void swap(SwapChainGL* _swapChain = NULL);
  29. void makeCurrent(SwapChainGL* _swapChain = NULL);
  30. void import();
  31. bool isValid() const
  32. {
  33. return 0 != m_context;
  34. }
  35. SwapChainGL* m_current;
  36. GLXContext m_context;
  37. XVisualInfo* m_visualInfo;
  38. ::Display* m_display;
  39. };
  40. } /* namespace gl */ } // namespace bgfx
  41. #endif // BGFX_USE_GLX
  42. #endif // BGFX_GLCONTEXT_GLX_H_HEADER_GUARD