2
0

BsGLSupport.h 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  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. /** @addtogroup GL
  10. * @{
  11. */
  12. /**
  13. * Helper class dealing mostly with platform specific OpenGL functionality, initialization, extensions and window
  14. * creation.
  15. */
  16. class BS_RSGL_EXPORT 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 RenderWindowPtr newWindow(RENDER_WINDOW_DESC& desc, UINT32 windowId, RenderWindowPtr 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. * @param[in] parentWindow Optional parent window if the window shouldn't be a main window. First created
  37. * window cannot have a parent.
  38. * @return Returns newly created window.
  39. */
  40. virtual SPtr<RenderWindowCore> newWindowCore(RENDER_WINDOW_DESC& desc, UINT32 windowId) = 0;
  41. /** Called when OpenGL is being initialized. */
  42. virtual void start() = 0;
  43. /** Called when OpenGL is being shut down. */
  44. virtual void stop() = 0;
  45. /** Gets OpenGL vendor name. */
  46. const String& getGLVendor() const
  47. {
  48. return mVendor;
  49. }
  50. /** Gets OpenGL version string. */
  51. const String& getGLVersion() const
  52. {
  53. return mVersion;
  54. }
  55. /** Checks is the specified extension available. */
  56. virtual bool checkExtension(const String& ext) const;
  57. /** Gets an address of an OpenGL procedure with the specified name. */
  58. virtual void* getProcAddress(const String& procname) = 0;
  59. /** Initializes OpenGL extensions. Must be called after we have a valid and active OpenGL context. */
  60. virtual void initializeExtensions();
  61. /** Gets a structure describing all available video modes. */
  62. virtual VideoModeInfoPtr getVideoModeInfo() const = 0;
  63. protected:
  64. Set<String> extensionList;
  65. String mVersion;
  66. String mVendor;
  67. };
  68. /** @} */
  69. };