glcontext_html5.h 1015 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. /*
  2. * Copyright 2011-2021 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx#license-bsd-2-clause
  4. */
  5. #ifndef BGFX_GLCONTEXT_HTML5_H_HEADER_GUARD
  6. #define BGFX_GLCONTEXT_HTML5_H_HEADER_GUARD
  7. #if BGFX_USE_HTML5
  8. namespace bgfx { namespace gl
  9. {
  10. struct SwapChainGL;
  11. struct GlContext
  12. {
  13. GlContext()
  14. : m_current(NULL)
  15. , m_primary(NULL)
  16. {
  17. }
  18. void create(uint32_t _width, uint32_t _height);
  19. void destroy();
  20. void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
  21. uint64_t getCaps() const;
  22. SwapChainGL* createSwapChain(void* _nwh);
  23. void destroySwapChain(SwapChainGL* _swapChain);
  24. void swap(SwapChainGL* _swapChain = NULL);
  25. void makeCurrent(SwapChainGL* _swapChain = NULL);
  26. void import(int webGLVersion);
  27. bool isValid() const
  28. {
  29. return NULL != m_primary;
  30. }
  31. SwapChainGL* m_current;
  32. SwapChainGL* m_primary;
  33. };
  34. } /* namespace gl */ } // namespace bgfx
  35. #endif // BGFX_USE_HTML5
  36. #endif // BGFX_GLCONTEXT_HTML5_H_HEADER_GUARD