Mercurial > hg > orthanc-stone
diff Framework/Viewport/SdlViewport.h @ 947:1091b2adeb5a toa2019081001
Fixed animation frame stopping when returning false + big work on the OpenGL
objects to make them lost context-safe + debug code to forcefully tag a
context as lost + debug macros
author | Benjamin Golinvaux <bgo@osimis.io> |
---|---|
date | Sat, 10 Aug 2019 13:07:31 +0200 |
parents | 685c9a2d115f |
children | a7351ad54960 |
line wrap: on
line diff
--- a/Framework/Viewport/SdlViewport.h Tue Aug 06 15:07:23 2019 +0200 +++ b/Framework/Viewport/SdlViewport.h Sat Aug 10 13:07:31 2019 +0200 @@ -61,13 +61,14 @@ virtual void UpdateSize(unsigned int width, unsigned int height) = 0; + }; class SdlOpenGLViewport : public SdlViewport { private: SdlOpenGLContext context_; - OpenGLCompositor compositor_; + std::auto_ptr<OpenGLCompositor> compositor_; public: SdlOpenGLViewport(const char* title, @@ -86,15 +87,21 @@ return context_.GetWindow(); } + bool OpenGLContextLost(); + virtual void UpdateSize(unsigned int width, unsigned int height) ORTHANC_OVERRIDE { // nothing to do in OpenGL, the OpenGLCompositor::UpdateSize will be called automatically } + virtual void Refresh() ORTHANC_OVERRIDE; protected: - virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE + virtual void DisableCompositor() ORTHANC_OVERRIDE; + virtual void RestoreCompositor() ORTHANC_OVERRIDE; + + virtual ICompositor* GetCompositor() ORTHANC_OVERRIDE { - return compositor_; + return compositor_.get(); } }; @@ -125,14 +132,17 @@ return window_; } + virtual void DisableCompositor() ORTHANC_OVERRIDE; + virtual void RestoreCompositor() ORTHANC_OVERRIDE; + virtual void Refresh() ORTHANC_OVERRIDE; virtual void UpdateSize(unsigned int width, unsigned int height) ORTHANC_OVERRIDE; protected: - virtual ICompositor& GetCompositor() ORTHANC_OVERRIDE + virtual ICompositor* GetCompositor() ORTHANC_OVERRIDE { - return compositor_; + return &compositor_; } private: