BsGLSupport.h 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  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 "RenderAPI/BsRenderWindow.h"
  7. namespace bs { namespace ct
  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 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 SPtr<bs::RenderWindow> newWindow(RENDER_WINDOW_DESC& desc, UINT32 windowId, SPtr<bs::RenderWindow> parentWindow) = 0;
  31. /** Called when OpenGL is being initialized. */
  32. virtual void start() = 0;
  33. /** Called when OpenGL is being shut down. */
  34. virtual void stop() = 0;
  35. /** Gets OpenGL vendor name. */
  36. const String& getGLVendor() const
  37. {
  38. return mVendor;
  39. }
  40. /** Gets OpenGL version string. */
  41. const String& getGLVersion() const
  42. {
  43. return mVersion;
  44. }
  45. /** Checks is the specified extension available. */
  46. virtual bool checkExtension(const String& ext) const;
  47. /** Gets an address of an OpenGL procedure with the specified name. */
  48. virtual void* getProcAddress(const String& procname) = 0;
  49. /** Initializes OpenGL extensions. Must be called after we have a valid and active OpenGL context. */
  50. virtual void initializeExtensions();
  51. /** Gets a structure describing all available video modes. */
  52. virtual SPtr<VideoModeInfo> getVideoModeInfo() const = 0;
  53. protected:
  54. Set<String> extensionList;
  55. String mVersion;
  56. String mVendor;
  57. };
  58. /** @} */
  59. }}