diff Applications/Sdl/SdlOpenGLContext.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 0aff28f15ea2
children a7351ad54960
line wrap: on
line diff
--- a/Applications/Sdl/SdlOpenGLContext.h	Tue Aug 06 15:07:23 2019 +0200
+++ b/Applications/Sdl/SdlOpenGLContext.h	Sat Aug 10 13:07:31 2019 +0200
@@ -26,6 +26,8 @@
 #include "../../Framework/OpenGL/IOpenGLContext.h"
 #include "SdlWindow.h"
 
+#include <Core/Enumerations.h>
+
 namespace OrthancStone
 {
   class SdlOpenGLContext : public OpenGL::IOpenGLContext
@@ -33,6 +35,7 @@
   private:
     SdlWindow      window_;
     SDL_GLContext  context_;
+    bool           contextLost_;
 
   public:
     SdlOpenGLContext(const char* title,
@@ -47,13 +50,23 @@
       return window_;
     }
 
-    virtual void MakeCurrent();
+    virtual bool IsContextLost() const ORTHANC_OVERRIDE;
+
+    virtual void SetLostContext() ORTHANC_OVERRIDE;
+    virtual void RestoreLostContext() ORTHANC_OVERRIDE;
 
-    virtual void SwapBuffer();
+    virtual void MakeCurrent() ORTHANC_OVERRIDE;
+
+    virtual void SwapBuffer() ORTHANC_OVERRIDE;
 
-    virtual unsigned int GetCanvasWidth() const;
+    virtual unsigned int GetCanvasWidth() const ORTHANC_OVERRIDE;
+
+    virtual unsigned int GetCanvasHeight() const ORTHANC_OVERRIDE;
 
-    virtual unsigned int GetCanvasHeight() const;
+    virtual void* DebugGetInternalContext() const ORTHANC_OVERRIDE
+    {
+      return context_;
+    }
   };
 }