BsGLSupport.h 2.2 KB

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