Mercurial > hg > orthanc-stone
comparison 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 |
comparison
equal
deleted
inserted
replaced
946:dbe3e1e47019 | 947:1091b2adeb5a |
---|---|
24 #if ORTHANC_ENABLE_SDL == 1 | 24 #if ORTHANC_ENABLE_SDL == 1 |
25 | 25 |
26 #include "../../Framework/OpenGL/IOpenGLContext.h" | 26 #include "../../Framework/OpenGL/IOpenGLContext.h" |
27 #include "SdlWindow.h" | 27 #include "SdlWindow.h" |
28 | 28 |
29 #include <Core/Enumerations.h> | |
30 | |
29 namespace OrthancStone | 31 namespace OrthancStone |
30 { | 32 { |
31 class SdlOpenGLContext : public OpenGL::IOpenGLContext | 33 class SdlOpenGLContext : public OpenGL::IOpenGLContext |
32 { | 34 { |
33 private: | 35 private: |
34 SdlWindow window_; | 36 SdlWindow window_; |
35 SDL_GLContext context_; | 37 SDL_GLContext context_; |
38 bool contextLost_; | |
36 | 39 |
37 public: | 40 public: |
38 SdlOpenGLContext(const char* title, | 41 SdlOpenGLContext(const char* title, |
39 unsigned int width, | 42 unsigned int width, |
40 unsigned int height, | 43 unsigned int height, |
45 SdlWindow& GetWindow() | 48 SdlWindow& GetWindow() |
46 { | 49 { |
47 return window_; | 50 return window_; |
48 } | 51 } |
49 | 52 |
50 virtual void MakeCurrent(); | 53 virtual bool IsContextLost() const ORTHANC_OVERRIDE; |
51 | 54 |
52 virtual void SwapBuffer(); | 55 virtual void SetLostContext() ORTHANC_OVERRIDE; |
56 virtual void RestoreLostContext() ORTHANC_OVERRIDE; | |
53 | 57 |
54 virtual unsigned int GetCanvasWidth() const; | 58 virtual void MakeCurrent() ORTHANC_OVERRIDE; |
55 | 59 |
56 virtual unsigned int GetCanvasHeight() const; | 60 virtual void SwapBuffer() ORTHANC_OVERRIDE; |
61 | |
62 virtual unsigned int GetCanvasWidth() const ORTHANC_OVERRIDE; | |
63 | |
64 virtual unsigned int GetCanvasHeight() const ORTHANC_OVERRIDE; | |
65 | |
66 virtual void* DebugGetInternalContext() const ORTHANC_OVERRIDE | |
67 { | |
68 return context_; | |
69 } | |
57 }; | 70 }; |
58 } | 71 } |
59 | 72 |
60 #endif | 73 #endif |