glcontext_glx.h 1.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. /*
  2. * Copyright 2011-2016 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. {
  20. }
  21. void create(uint32_t _width, uint32_t _height);
  22. void destroy();
  23. void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
  24. uint64_t getCaps() const;
  25. SwapChainGL* createSwapChain(void* _nwh);
  26. void destroySwapChain(SwapChainGL* _swapChain);
  27. void swap(SwapChainGL* _swapChain = NULL);
  28. void makeCurrent(SwapChainGL* _swapChain = NULL);
  29. void import();
  30. bool isValid() const
  31. {
  32. return 0 != m_context;
  33. }
  34. SwapChainGL* m_current;
  35. GLXContext m_context;
  36. XVisualInfo* m_visualInfo;
  37. };
  38. } /* namespace gl */ } // namespace bgfx
  39. #endif // BGFX_USE_GLX
  40. #endif // BGFX_GLCONTEXT_GLX_H_HEADER_GUARD