VTK  9.2.6
vtkSDL2OpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkSDL2OpenGL2RenderWindow.h
5 
6 Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7 All rights reserved.
8 See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10 This software is distributed WITHOUT ANY WARRANTY; without even
11 the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12 PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
24 #ifndef vtkSDL2OpenGLRenderWindow_h
25 #define vtkSDL2OpenGLRenderWindow_h
26 
27 #include "vtkOpenGLRenderWindow.h"
28 #include "vtkRenderingOpenGL2Module.h" // For export macro
29 #include <SDL2/SDL.h> // for ivars
30 #include <stack> // for ivar
31 
32 class VTKRENDERINGOPENGL2_EXPORT vtkSDL2OpenGLRenderWindow : public vtkOpenGLRenderWindow
33 {
34 public:
37  void PrintSelf(ostream& os, vtkIndent indent) override;
38 
45  void Initialize(void) override;
46 
52  void Finalize(void) override;
53 
57  void SetFullScreen(vtkTypeBool) override;
58 
62  void SetShowWindow(bool val) override;
63 
65 
68  void SetSize(int, int) override;
69  void SetSize(int a[2]) override { vtkOpenGLRenderWindow::SetSize(a); }
71 
75  int* GetSize() VTK_SIZEHINT(2) override;
76 
78 
81  void SetPosition(int, int) override;
82  void SetPosition(int a[2]) override { vtkOpenGLRenderWindow::SetPosition(a); }
84 
88  int* GetScreenSize() VTK_SIZEHINT(2) override;
89 
93  int* GetPosition() VTK_SIZEHINT(2) override;
94 
99  void SetWindowName(const char*) override;
100 
101  void* GetGenericDisplayId() override { return (void*)this->ContextId; }
102  void* GetGenericWindowId() override { return (void*)this->WindowId; }
103  void* GetGenericDrawable() override { return (void*)this->WindowId; }
104 
108  void MakeCurrent() override;
109 
113  void ReleaseCurrent() override;
114 
118  bool IsCurrent() override;
119 
123  void Clean();
124 
129  void Frame() override;
130 
132 
139  void PushContext() override;
140  void PopContext() override;
142 
152  bool SetSwapControl(int i) override;
153 
158  int GetColorBufferSizes(int* rgba) override;
159 
161 
165  void HideCursor() override;
166  void ShowCursor() override;
168 
169 protected:
171  ~vtkSDL2OpenGLRenderWindow() override;
172 
173  SDL_Window* WindowId;
174  SDL_GLContext ContextId;
175  std::stack<SDL_GLContext> ContextStack;
176  std::stack<SDL_Window*> WindowStack;
177  int ScreenSize[2];
179 
180  void CleanUpRenderers();
181  void CreateAWindow() override;
182  void DestroyWindow() override;
183 
184 private:
186  void operator=(const vtkSDL2OpenGLRenderWindow&) = delete;
187 };
188 
189 #endif
OpenGL rendering window.
virtual void SetFullScreen(vtkTypeBool)
Turn on/off rendering full screen window size.
virtual void HideCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
std::stack< SDL_Window * > WindowStack
void SetSize(int a[2]) override
Set the size of the window in pixels.
static vtkRenderWindow * New()
Construct an instance of vtkRenderWindow with its screen size set to 300x300, borders turned on...
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
virtual void SetPosition(int x, int y)
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual bool IsCurrent()
Tells if this window is the current graphics context for the calling thread.
static const std::string DEFAULT_BASE_WINDOW_NAME
virtual void Finalize()
Finalize the rendering process.
virtual void SetShowWindow(bool)
Show or not Show the window.
int vtkTypeBool
Definition: vtkABI.h:69
virtual void SetSize(int width, int height)
Set the size (width and height) of the rendering window in screen coordinates (in pixels)...
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
virtual void ShowCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual int * GetScreenSize()
Get the current size of the screen in pixels.
Definition: vtkWindow.h:105
std::stack< SDL_GLContext > ContextStack
int GetColorBufferSizes(int *rgba) override
Get the size of the color buffer.
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:246
virtual void PushContext()
Ability to push and pop this window's context as the current context.
#define VTK_SIZEHINT(...)
virtual bool SetSwapControl(int)
Set the number of vertical syncs required between frames.
void Frame() override
A termination method performed at the end of the rendering process to do things like swapping buffers...
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
virtual int * GetSize()
Get the size (width and height) of the rendering window in screen coordinates (in pixels)...
virtual void ReleaseCurrent()
Release the current context.
Definition: vtkWindow.h:252
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void Initialize(void)
Initialize the rendering window.
virtual void CreateAWindow()=0
Create a not-off-screen window.