BsGLSupport.h 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
  2. //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
  3. #pragma once
  4. #include "BsGLPrerequisites.h"
  5. #include "BsGLRenderAPI.h"
  6. #include "RenderAPI/BsRenderWindow.h"
  7. namespace bs { namespace ct
  8. {
  9. /** @addtogroup GL
  10. * @{
  11. */
  12. /**
  13. * Helper class dealing mostly with platform specific OpenGL functionality, initialization, extensions and window
  14. * creation.
  15. */
  16. class GLSupport
  17. {
  18. public:
  19. GLSupport() { }
  20. virtual ~GLSupport() { }
  21. /**
  22. * Creates a new render window using the specified descriptor.
  23. *
  24. * @param[in] desc Description of a render window to create.
  25. * @param[in] windowId Window ID provided by the render window manager.
  26. * @param[in] parentWindow Optional parent window if the window shouldn't be a main window. First created
  27. * window cannot have a parent.
  28. * @return Returns newly created window.
  29. */
  30. virtual SPtr<bs::RenderWindow> newWindow(RENDER_WINDOW_DESC& desc, UINT32 windowId, SPtr<bs::RenderWindow> parentWindow) = 0;
  31. /**
  32. * Creates a new render window using the specified descriptor.
  33. *
  34. * @param[in] desc Description of a render window to create.
  35. * @param[in] windowId Window ID provided by the render window manager.
  36. * @return Returns newly created window.
  37. */
  38. virtual SPtr<RenderWindow> newWindowCore(RENDER_WINDOW_DESC& desc, UINT32 windowId) = 0;
  39. /** Called when OpenGL is being initialized. */
  40. virtual void start() = 0;
  41. /** Called when OpenGL is being shut down. */
  42. virtual void stop() = 0;
  43. /** Gets OpenGL vendor name. */
  44. const String& getGLVendor() const
  45. {
  46. return mVendor;
  47. }
  48. /** Gets OpenGL version string. */
  49. const String& getGLVersion() const
  50. {
  51. return mVersion;
  52. }
  53. /** Checks is the specified extension available. */
  54. virtual bool checkExtension(const String& ext) const;
  55. /** Gets an address of an OpenGL procedure with the specified name. */
  56. virtual void* getProcAddress(const String& procname) = 0;
  57. /** Initializes OpenGL extensions. Must be called after we have a valid and active OpenGL context. */
  58. virtual void initializeExtensions();
  59. /** Gets a structure describing all available video modes. */
  60. virtual SPtr<VideoModeInfo> getVideoModeInfo() const = 0;
  61. protected:
  62. Set<String> extensionList;
  63. String mVersion;
  64. String mVendor;
  65. };
  66. /** @} */
  67. }}