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