diff options
author | Caolán McNamara <caolanm@redhat.com> | 2016-05-20 09:41:18 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2016-05-21 10:04:15 +0100 |
commit | b8d163f4334424e78290eae49713e6ba2405b30f (patch) | |
tree | 55e78506accb6fe4dbbc1ecb918e4ccc2f510254 /include/vcl/opengl | |
parent | da03b62bb4d44ad1410a4dff15f97bacd55fb99b (diff) |
Split OpenGLContext up into SalInstance specific classes
which, at least theoretically, allows there to be vclplug
specific ones. i.e. a gtk3 specific one which doesn't
assume gtk3 is running under X
Change-Id: I6c007a87abbd3049b6fffc70d349e3b7ac445eec
Diffstat (limited to 'include/vcl/opengl')
-rw-r--r-- | include/vcl/opengl/OpenGLContext.hxx | 50 |
1 files changed, 23 insertions, 27 deletions
diff --git a/include/vcl/opengl/OpenGLContext.hxx b/include/vcl/opengl/OpenGLContext.hxx index 1ca86c7acb61..00368495a332 100644 --- a/include/vcl/opengl/OpenGLContext.hxx +++ b/include/vcl/opengl/OpenGLContext.hxx @@ -65,7 +65,7 @@ class OpenGLTests; class RenderState; /// Holds the information of our new child window -struct GLWindow +struct VCL_DLLPUBLIC GLWindow { #if defined( _WIN32 ) HWND hWnd; @@ -121,16 +121,19 @@ struct GLWindow { } + bool Synchronize(bool bOnoff) const; + ~GLWindow(); }; class VCL_DLLPUBLIC OpenGLContext { friend class OpenGLTests; +protected: OpenGLContext(); public: static rtl::Reference<OpenGLContext> Create(); - ~OpenGLContext(); + virtual ~OpenGLContext(); void acquire() { mnRefCount++; } void release() { if ( --mnRefCount == 0 ) delete this; } void dispose(); @@ -141,13 +144,6 @@ public: bool init(vcl::Window* pParent = nullptr); bool init(SystemChildWindow* pChildWindow); -// these methods are for the deep platform layer, don't use them in normal code -// only in vcl's platform code -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) - bool init(Display* dpy, Window win, int screen); -#elif defined( _WIN32 ) - bool init( HDC hDC, HWND hWnd ); -#endif void reset(); // use these methods right after setting a context to make sure drawing happens @@ -173,7 +169,9 @@ public: } /// Is this GL context the current context ? - bool isCurrent(); + virtual bool isCurrent(); + /// Is any GL context the current context ? + virtual bool isAnyCurrent(); /// release bound resources from the current context static void clearCurrent(); /// release contexts etc. before (potentially) allowing another thread run. @@ -186,13 +184,13 @@ public: /// fetch any VCL context, creating one if bMakeIfNecessary is set. static rtl::Reference<OpenGLContext> getVCLContext(bool bMakeIfNecessary = true); /// make this GL context current - so it is implicit in subsequent GL calls - void makeCurrent(); + virtual void makeCurrent(); /// Put this GL context to the end of the context list. void registerAsCurrent(); /// reset the GL context so this context is not implicit in subsequent GL calls. - void resetCurrent(); - void swapBuffers(); - void sync(); + virtual void resetCurrent(); + virtual void swapBuffers(); + virtual void sync(); void show(); void setWinPosAndSize(const Point &rPos, const Size& rSize); @@ -213,23 +211,20 @@ public: bool supportMultiSampling() const; - static SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext); + virtual SystemWindowData generateWinData(vcl::Window* pParent, bool bRequestLegacyContext); private: - SAL_DLLPRIVATE bool InitGLEW(); - SAL_DLLPRIVATE void InitGLEWDebugging(); - SAL_DLLPRIVATE bool initWindow(); - SAL_DLLPRIVATE bool ImplInit(); - SAL_DLLPRIVATE void InitChildWindow(SystemChildWindow *pChildWindow); -#if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID && !defined(LIBO_HEADLESS) - SAL_DLLPRIVATE void initGLWindow(Visual* pVisual); -#endif - -#if defined(MACOSX) - NSOpenGLView* getOpenGLView(); -#endif + virtual bool initWindow(); + virtual void destroyCurrentContext(); +protected: GLWindow m_aGLWin; + bool InitGLEW(); + void InitGLEWDebugging(); + void InitChildWindow(SystemChildWindow *pChildWindow); + void BuffersSwapped(); + virtual bool ImplInit(); + VclPtr<vcl::Window> m_xWindow; VclPtr<vcl::Window> mpWindow; //points to m_pWindow or the parent window, don't delete it VclPtr<SystemChildWindow> m_pChildWindow; @@ -244,6 +239,7 @@ private: OpenGLFramebuffer* mpFirstFramebuffer; OpenGLFramebuffer* mpLastFramebuffer; +private: struct ProgramHash { size_t operator()( const rtl::OString& aDigest ) const |