glcontext_html5.h 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. /*
  2. * Copyright 2011-2023 Branimir Karadzic. All rights reserved.
  3. * License: https://github.com/bkaradzic/bgfx/blob/master/LICENSE
  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. , m_msaaContext(false)
  17. {
  18. }
  19. void create(uint32_t _width, uint32_t _height, uint32_t _flags);
  20. void destroy();
  21. void resize(uint32_t _width, uint32_t _height, uint32_t _flags);
  22. uint64_t getCaps() const;
  23. SwapChainGL* createSwapChain(void* _nwh);
  24. void destroySwapChain(SwapChainGL* _swapChain);
  25. void swap(SwapChainGL* _swapChain = NULL);
  26. void makeCurrent(SwapChainGL* _swapChain = NULL);
  27. void import(int webGLVersion);
  28. bool isValid() const
  29. {
  30. return NULL != m_primary;
  31. }
  32. SwapChainGL* m_current;
  33. SwapChainGL* m_primary;
  34. // true when MSAA is handled by the context instead of using MSAA FBO
  35. bool m_msaaContext;
  36. };
  37. } /* namespace gl */ } // namespace bgfx
  38. #endif // BGFX_USE_HTML5
  39. #endif // BGFX_GLCONTEXT_HTML5_H_HEADER_GUARD