VTK  9.3.0
vtkWin32OpenGLRenderWindow.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
12#ifndef vtkWin32OpenGLRenderWindow_h
13#define vtkWin32OpenGLRenderWindow_h
14
16#include "vtkRenderingOpenGL2Module.h" // For export macro
17#include <stack> // for ivar
18
19#include "vtkWindows.h" // For windows API
20
21VTK_ABI_NAMESPACE_BEGIN
22class vtkIdList;
23
24class VTKRENDERINGOPENGL2_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
25{
26public:
29 void PrintSelf(ostream& os, vtkIndent indent) override;
30
34 void Frame() override;
35
39 virtual void WindowInitialize();
40
47 void Initialize() override;
48
54 void Finalize() override;
55
59 void SetFullScreen(vtkTypeBool) override;
60
64 void WindowRemap() override;
65
69 void SetShowWindow(bool val) override;
70
74 virtual void PrefFullScreen();
75
77
85 void SetSize(int width, int height) override;
86 void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
88
93 int* GetSize() VTK_SIZEHINT(2) override;
94
96
101 void SetPosition(int x, int y) override;
102 void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
104
109 int* GetScreenSize() VTK_SIZEHINT(2) override;
110
115 int* GetPosition() VTK_SIZEHINT(2) override;
116
121 void SetWindowName(const char*) override;
122
126 void SetIcon(vtkImageData* img) override;
127
131 void SetWindowInfo(const char*) override;
132
136 void SetNextWindowInfo(const char*) override;
137
141 void SetParentInfo(const char*) override;
142
143 void* GetGenericDisplayId() override { return (void*)this->ContextId; }
144 void* GetGenericWindowId() override { return (void*)this->WindowId; }
145 void* GetGenericParentId() override { return (void*)this->ParentId; }
146 void* GetGenericContext() override { return (void*)this->DeviceContext; }
147 void* GetGenericDrawable() override { return (void*)this->WindowId; }
148 void SetDisplayId(void*) override;
149
154
156
159 void SetWindowId(HWND);
160 void SetWindowId(void* foo) override { this->SetWindowId((HWND)foo); }
162
168
172 bool GetPlatformSupportsRenderWindowSharing() override { return true; }
173
175
178 void SetParentId(HWND);
179 void SetParentId(void* foo) override { this->SetParentId((HWND)foo); }
181
182 void SetContextId(HGLRC); // hsr
183 void SetDeviceContext(HDC); // hsr
184
188 void SetNextWindowId(HWND);
189
195 void SetNextWindowId(void* arg) override;
196
203 void SetStereoCapableWindow(vtkTypeBool capable) override;
204
208 void MakeCurrent() override;
209
213 void ReleaseCurrent() override;
214
218 bool IsCurrent() override;
219
223 const char* ReportCapabilities() override;
224
229
236
238
241 virtual void SetupPalette(HDC hDC);
243 HDC hDC, DWORD dwFlags, int debug, int bpp = 16, int zbpp = 16);
245
249 void Clean();
250
252
258 void HideCursor() override;
259 void ShowCursor() override;
260 void SetCursorPosition(int x, int y) override;
262
266 void SetCurrentCursor(int) override;
267
268 bool DetectDPI() override;
269
271
278 void PushContext() override;
279 void PopContext() override;
281
291 bool SetSwapControl(int i) override;
292
293protected:
296
298 HPALETTE Palette;
299 HPALETTE OldPalette;
309 static const std::string DEFAULT_BASE_WINDOW_NAME;
310
311 std::stack<HGLRC> ContextStack;
312 std::stack<HDC> DCStack;
313
314 // message handler
315 virtual LRESULT MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
316
317 static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
320
322 void ResizeWhileOffscreen(int xsize, int ysize);
323 void CreateAWindow() override;
324 void DestroyWindow() override;
328
329private:
331 void operator=(const vtkWin32OpenGLRenderWindow&) = delete;
332};
333
334VTK_ABI_NAMESPACE_END
335#endif
list of point or cell ids
Definition vtkIdList.h:23
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
OpenGL rendering window.
void DestroyWindow() override
Destroy a not-off-screen window.
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
void Clean()
Clean up device contexts, rendering contexts, etc.
static const std::string DEFAULT_BASE_WINDOW_NAME
virtual LRESULT MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void SetWindowId(HWND)
Set the window id to a pre-existing window.
void SetWindowId(void *foo) override
Set the window id to a pre-existing window.
static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
void SetNextWindowId(void *arg) override
Set the window id of the new window once a WindowRemap is done.
vtkTypeBool IsDirect() override
Is this render window using hardware acceleration? 0-false, 1-true.
~vtkWin32OpenGLRenderWindow() override
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
bool SetSwapControl(int i) override
Set the number of vertical syncs required between frames.
void SetFullScreen(vtkTypeBool) override
Change the window to fill the entire screen.
void WindowRemap() override
Remap the window.
void Frame() override
End the rendering process and display the image.
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...
vtkTypeBool GetEventPending() override
Check to see if a mouse button has been pressed or mouse wheel activated.
void SetShowWindow(bool val) override
Show or not Show the window.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
HWND GetWindowId()
Get the window id.
static vtkWin32OpenGLRenderWindow * New()
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...
int * GetSize() override
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
void SetCursorPosition(int x, int y) 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 * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
virtual void WindowInitialize()
Create the window.
void Finalize() override
Finalize the rendering window.
bool DetectDPI() override
Attempt to detect and set the DPI of the display device by querying the system.
int * GetScreenSize() override
Get the current size of the screen in pixels.
void PushContext() override
Ability to push and pop this window's context as the current context.
void SetCurrentCursor(int) override
Change the shape of the cursor.
void SetSize(int a[2]) override
Set the size (width and height) of the rendering window in screen coordinates (in pixels).
bool InitializeFromCurrentContext() override
Initialize the render window from the information associated with the currently activated OpenGL cont...
void SetDisplayId(void *) override
Dummy stubs for vtkWindow API.
virtual void PrefFullScreen()
Set the preferred window size to full screen.
bool GetPlatformSupportsRenderWindowSharing() override
Does this platform support render window data sharing.
void SetStereoCapableWindow(vtkTypeBool capable) override
Prescribe that the window be created in a stereo-capable mode.
void PopContext() override
Ability to push and pop this window's context as the current context.
virtual void SetupPixelFormatPaletteAndContext(HDC hDC, DWORD dwFlags, int debug, int bpp=16, int zbpp=16)
Initialize OpenGL for this window.
void SetParentId(void *foo) override
Set the window's parent id to a pre-existing window.
void SetNextWindowId(HWND)
Set the window id of the new window once a WindowRemap is done.
bool IsCurrent() override
Tells if this window is the current OpenGL context for the calling thread.
void Initialize() override
Initialize the rendering window.
void SetParentId(HWND)
Set the window's parent id to a pre-existing window.
const char * ReportCapabilities() override
Get report of capabilities for the render window.
void MakeCurrent() override
Make this windows OpenGL context the current context.
void SetPosition(int a[2]) override
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
void SetSize(int width, int height) override
Set the size (width and height) of the rendering window in screen coordinates (in pixels).
void ResizeWhileOffscreen(int xsize, int ysize)
void CreateAWindow() override
Create a not-off-screen window.
void ReleaseCurrent() override
Release the current context.
virtual void SetupPalette(HDC hDC)
Initialize OpenGL for this window.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)