glcontext_egl.h 993 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. /*
  2. * Copyright 2011-2014 Branimir Karadzic. All rights reserved.
  3. * License: http://www.opensource.org/licenses/BSD-2-Clause
  4. */
  5. #ifndef BGFX_GLCONTEXT_EGL_H_HEADER_GUARD
  6. #define BGFX_GLCONTEXT_EGL_H_HEADER_GUARD
  7. #if BGFX_USE_EGL
  8. #include <EGL/egl.h>
  9. namespace bgfx
  10. {
  11. struct SwapChainGL;
  12. struct GlContext
  13. {
  14. GlContext()
  15. : m_context(NULL)
  16. , m_display(NULL)
  17. , m_surface(NULL)
  18. {
  19. }
  20. void create(uint32_t _width, uint32_t _height);
  21. void destroy();
  22. void resize(uint32_t _width, uint32_t _height, bool _vsync);
  23. SwapChainGL* createSwapChain(void* _nwh);
  24. void destorySwapChain(SwapChainGL* _swapChain);
  25. void swap(SwapChainGL* _swapChain = NULL);
  26. void makeCurrent(SwapChainGL* _swapChain = NULL);
  27. void import();
  28. bool isValid() const
  29. {
  30. return NULL != m_context;
  31. }
  32. void* m_eglLibrary;
  33. EGLContext m_context;
  34. EGLDisplay m_display;
  35. EGLSurface m_surface;
  36. };
  37. } // namespace bgfx
  38. #endif // BGFX_USE_EGL
  39. #endif // BGFX_GLCONTEXT_EGL_H_HEADER_GUARD