BsGLSupport.h 2.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798
  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 "BsRenderWindow.h"
  7. namespace BansheeEngine
  8. {
  9. /**
  10. * @brief Helper class dealing mostly with platform specific OpenGL functionality,
  11. * initialization, extensions and window creation.
  12. */
  13. class BS_RSGL_EXPORT GLSupport
  14. {
  15. public:
  16. GLSupport() { }
  17. virtual ~GLSupport() { }
  18. /**
  19. * @brief Creates a new render window using the specified descriptor.
  20. *
  21. * @param desc Description of a render window to create.
  22. * @param windowId Window ID provided by the render window manager.
  23. * @param parentWindow Optional parent window if the window shouldn't be a main window. First
  24. * created window cannot have a parent.
  25. *
  26. * @param Returns newly created window.
  27. */
  28. virtual RenderWindowPtr newWindow(RENDER_WINDOW_DESC& desc, UINT32 windowId, RenderWindowPtr parentWindow) = 0;
  29. /**
  30. * @brief Creates a new render window using the specified descriptor.
  31. *
  32. * @param desc Description of a render window to create.
  33. * @param windowId Window ID provided by the render window manager.
  34. * @param parentWindow Optional parent window if the window shouldn't be a main window. First
  35. * created window cannot have a parent.
  36. *
  37. * @param Returns newly created window.
  38. */
  39. virtual SPtr<RenderWindowCore> newWindowCore(RENDER_WINDOW_DESC& desc, UINT32 windowId) = 0;
  40. /**
  41. * @brief Called when OpenGL is being initialized.
  42. */
  43. virtual void start() = 0;
  44. /**
  45. * @brief Called when OpenGL is being shut down.
  46. */
  47. virtual void stop() = 0;
  48. /**
  49. * @brief Gets OpenGL vendor name.
  50. */
  51. const String& getGLVendor() const
  52. {
  53. return mVendor;
  54. }
  55. /**
  56. * @brief Gets OpenGL version string.
  57. */
  58. const String& getGLVersion() const
  59. {
  60. return mVersion;
  61. }
  62. /**
  63. * @brief Checks is the specified extension available.
  64. */
  65. virtual bool checkExtension(const String& ext) const;
  66. /**
  67. * @brief Gets an address of an OpenGL procedure with the specified name.
  68. */
  69. virtual void* getProcAddress(const String& procname) = 0;
  70. /**
  71. * @brief Initializes OpenGL extensions. Must be called after we have a valid and active
  72. * OpenGL context.
  73. */
  74. virtual void initializeExtensions();
  75. /**
  76. * @brief Gets a structure describing all available video modes.
  77. */
  78. virtual VideoModeInfoPtr getVideoModeInfo() const = 0;
  79. protected:
  80. Set<String> extensionList;
  81. String mVersion;
  82. String mVendor;
  83. };
  84. };