BsGLSupport.h 2.4 KB

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