VTK  9.1.0
vtkSDL2OpenGLRenderWindow.h
Go to the documentation of this file.
1/*=========================================================================
2
3Program: Visualization Toolkit
4Module: vtkSDL2OpenGL2RenderWindow.h
5
6Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7All rights reserved.
8See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9
10This software is distributed WITHOUT ANY WARRANTY; without even
11the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12PURPOSE. See the above copyright notice for more information.
13
14=========================================================================*/
24#ifndef vtkSDL2OpenGLRenderWindow_h
25#define vtkSDL2OpenGLRenderWindow_h
26
28#include "vtkRenderingOpenGL2Module.h" // For export macro
29#include <SDL2/SDL.h> // for ivars
30#include <stack> // for ivar
31
32class VTKRENDERINGOPENGL2_EXPORT vtkSDL2OpenGLRenderWindow : public vtkOpenGLRenderWindow
33{
34public:
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
169protected:
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
181 void CreateAWindow() override;
182 void DestroyWindow() override;
183
184private:
186 void operator=(const vtkSDL2OpenGLRenderWindow&) = delete;
187};
188
189#endif
a simple class to control print indentation
Definition: vtkIndent.h:113
OpenGL rendering window.
void Frame() override
A termination method performed at the end of the rendering process to do things like swapping buffers...
void Initialize(void) override
Initialize the rendering window.
void MakeCurrent() override
Make this windows OpenGL context the current context.
void SetFullScreen(vtkTypeBool) override
Change the window to fill the entire screen.
int * GetScreenSize() override
Get the current size of the screen in pixels.
void DestroyWindow() override
Destroy a not-off-screen window.
static const std::string DEFAULT_BASE_WINDOW_NAME
void PushContext() override
Ability to push and pop this window's context as the current context.
void PopContext() override
Ability to push and pop this window's context as the current context.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
int * GetSize() override
Get the current size of the window in pixels.
void SetShowWindow(bool val) override
Show or not Show the window.
bool IsCurrent() override
Tells if this window is the current OpenGL context for the calling thread.
std::stack< SDL_Window * > WindowStack
static vtkSDL2OpenGLRenderWindow * New()
void SetSize(int a[2]) override
Set the size of the window in pixels.
void SetSize(int, int) override
Set the size of the window in pixels.
void ShowCursor() override
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
void Clean()
Clean up device contexts, rendering contexts, etc.
void HideCursor() override
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
void ReleaseCurrent() override
Release the current context.
~vtkSDL2OpenGLRenderWindow() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
std::stack< SDL_GLContext > ContextStack
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
void CreateAWindow() override
Create a not-off-screen window.
bool SetSwapControl(int i) override
Set the number of vertical syncs required between frames.
void Finalize(void) override
Finalize the rendering window.
int GetColorBufferSizes(int *rgba) override
Get the size of the color buffer.
virtual void SetPosition(int x, int y)
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual void SetSize(int width, int height)
Set the size (width and height) of the rendering window in screen coordinates (in pixels).
@ string
Definition: vtkX3D.h:496
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)