| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081 |
- //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
- //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
- #pragma once
- #include "Win32/BsWin32Prerequisites.h"
- #include "BsGLSupport.h"
- #include "BsGLRenderAPI.h"
- namespace bs { namespace ct
- {
- /** @addtogroup GL
- * @{
- */
- /** Handles OpenGL initialization, window creation and extensions on Windows. */
- class Win32GLSupport : public GLSupport
- {
- public:
- Win32GLSupport();
- /** @copydoc GLSupport::newWindow */
- SPtr<bs::RenderWindow> newWindow(RENDER_WINDOW_DESC& desc, UINT32 windowId, SPtr<bs::RenderWindow> parentWindow) override;
- /** @copydoc GLSupport::newWindowCore */
- SPtr<RenderWindow> newWindowCore(RENDER_WINDOW_DESC& desc, UINT32 windowId) override;
- /** @copydoc GLSupport::start */
- void start() override;
- /** @copydoc GLSupport::stop */
- void stop() override;
- /** @copydoc GLSupport::getProcAddress */
- void* getProcAddress(const String& procname) override;
- /** @copydoc GLSupport::initializeExtensions */
- void initializeExtensions() override;
-
- /**
- * Creates a new OpenGL context.
- *
- * @param[in] hdc Handle to device context to create the context from.
- * @param[in] externalGlrc (Optional) Handle to external OpenGL context. If not provided new context will be
- * created.
- * @return Newly created GLContext class referencing the created or external context handle.
- */
- SPtr<Win32Context> createContext(HDC hdc, HGLRC externalGlrc = 0);
- /**
- * Selects and sets an appropriate pixel format based on the provided parameters.
- *
- * @param[in] hdc Handle to device context to create the context from.
- * @param[in] colorDepth Wanted color depth of the pixel format, in bits.
- * @param[in] multisample Amount of multisampling wanted, if any.
- * @param[in] hwGamma Should the format support automatic gamma conversion on write/read.
- * @param[in] depth Should the pixel format contain the depth/stencil buffer.
- * @return True if a pixel format was successfully set.
- */
- bool selectPixelFormat(HDC hdc, int colorDepth, int multisample, bool hwGamma, bool depth);
- /** @copydoc GLSupport::getVideoModeInfo */
- SPtr<VideoModeInfo> getVideoModeInfo() const override;
- private:
- /** Initializes windows specific OpenGL extensions needed for advanced context creation. */
- void initialiseWGL();
- /** Dummy window procedure used when creating the initial dummy OpenGL context. */
- static LRESULT CALLBACK dummyWndProc(HWND hwnd, UINT umsg, WPARAM wp, LPARAM lp);
- Vector<DEVMODE> mDevModes;
- Win32RenderWindow *mInitialWindow;
- Vector<int> mMultisampleLevels;
- bool mHasPixelFormatARB;
- bool mHasMultisample;
- bool mHasHardwareGamma;
- bool mHasAdvancedContext;
- };
- /** @} */
- }}
|