BsGLSupport.h 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. #pragma once
  2. #include "BsGLPrerequisites.h"
  3. #include "BsGLRenderSystem.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 Called when OpenGL is being initialized.
  28. */
  29. virtual void start() = 0;
  30. /**
  31. * @brief Called when OpenGL is being shut down.
  32. */
  33. virtual void stop() = 0;
  34. /**
  35. * @brief Gets OpenGL vendor name.
  36. */
  37. const String& getGLVendor() const
  38. {
  39. return mVendor;
  40. }
  41. /**
  42. * @brief Gets OpenGL version string.
  43. */
  44. const String& getGLVersion() const
  45. {
  46. return mVersion;
  47. }
  48. /**
  49. * @brief Checks is the specified extension available.
  50. */
  51. virtual bool checkExtension(const String& ext) const;
  52. /**
  53. * @brief Gets an address of an OpenGL procedure with the specified name.
  54. */
  55. virtual void* getProcAddress(const String& procname) = 0;
  56. /**
  57. * @brief Initializes OpenGL extensions. Must be called after we have a valid and active
  58. * OpenGL context.
  59. */
  60. virtual void initializeExtensions();
  61. /**
  62. * @brief Gets a structure describing all available video modes.
  63. */
  64. virtual VideoModeInfoPtr getVideoModeInfo() const = 0;
  65. protected:
  66. Set<String> extensionList;
  67. String mVersion;
  68. String mVendor;
  69. };
  70. };