BsMacOSContext.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2017 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "BsGLContext.h"
  6. namespace bs::ct
  7. {
  8. /** @addtogroup GL
  9. * @{
  10. */
  11. /** MacOS specific implementation of an OpenGL context. */
  12. class MacOSContext : public GLContext
  13. {
  14. struct Pimpl;
  15. public:
  16. /**
  17. * Constructs a new OpenGL context.
  18. *
  19. * @param[in] depthStencil True if the framebuffer using the context can have a depth-stencil buffer.
  20. * @param[in] msaaCount Number of samples the framebuffer using the context is allowed to have.
  21. */
  22. MacOSContext(bool depthStencil, UINT32 msaaCount);
  23. virtual ~MacOSContext();
  24. /** @copydoc GLContext::setCurrent */
  25. void setCurrent(const RenderWindow& window) override;
  26. /** @copydoc GLContext::endCurrent */
  27. void endCurrent() override;
  28. /** @copydoc GLContext::releaseContext */
  29. void releaseContext() override;
  30. /** Marks the context as dirty and requiring update. Should be called when the drawable changes size or location. */
  31. void markAsDirty();
  32. /** Updates the context if dirty. */
  33. void updateIfDirty();
  34. /** Enables or disables VSync using the specified interval. Interval of 0 disables VSync. */
  35. void setVSync(int interval);
  36. /** Swaps the framebuffer currently attached to this context. */
  37. void swapBuffers();
  38. /**
  39. * Locks the context so it can safely be used across threads. Should be called before performing any OpenGL
  40. * action or direct operation on the context. When done unlock it via unlock().
  41. */
  42. void lock();
  43. /** Unlocks the context locked via lock(). */
  44. void unlock();
  45. private:
  46. Pimpl* m;
  47. };
  48. /** @} */
  49. }