VTK  9.5.2
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
11
12#ifndef vtkWin32OpenGLRenderWindow_h
13#define vtkWin32OpenGLRenderWindow_h
14
16
17#include "vtkRenderingOpenGL2Module.h" // For export macro
18#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
19#include <stack> // for ivar
20
21#include "vtkWindows.h" // For windows API
22
23VTK_ABI_NAMESPACE_BEGIN
24class vtkIdList;
25
26class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkWin32OpenGLRenderWindow
28{
29public:
32 void PrintSelf(ostream& os, vtkIndent indent) override;
33
37 void Frame() override;
38
42 virtual void WindowInitialize();
43
50 void Initialize() override;
51
57 void Finalize() override;
58
62 void SetFullScreen(vtkTypeBool) override;
63
67 void WindowRemap() override;
68
72 void SetShowWindow(bool val) override;
73
77 virtual void PrefFullScreen();
78
80
88 void SetSize(int width, int height) override;
89 void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
91
96 int* GetSize() VTK_SIZEHINT(2) override;
97
99
104 void SetPosition(int x, int y) override;
105 void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
107
112 int* GetScreenSize() VTK_SIZEHINT(2) override;
113
118 int* GetPosition() VTK_SIZEHINT(2) override;
119
124 void SetWindowName(const char*) override;
125
129 void SetIcon(vtkImageData* img) override;
130
134 void SetWindowInfo(const char*) override;
135
139 void SetNextWindowInfo(const char*) override;
140
144 void SetParentInfo(const char*) override;
145
146 void* GetGenericDisplayId() override { return (void*)this->ContextId; }
147 void* GetGenericWindowId() override { return (void*)this->WindowId; }
148 void* GetGenericParentId() override { return (void*)this->ParentId; }
149 void* GetGenericContext() override { return (void*)this->DeviceContext; }
150 void* GetGenericDrawable() override { return (void*)this->WindowId; }
151 void SetDisplayId(void*) override;
152
158
160
164 void SetWindowId(HWND);
166 void SetWindowId(void* foo) override { this->SetWindowId((HWND)foo); }
168
174
178 bool GetPlatformSupportsRenderWindowSharing() override { return true; }
179
181
184 void SetParentId(HWND);
185 void SetParentId(void* foo) override { this->SetParentId((HWND)foo); }
187
188 void SetContextId(HGLRC); // hsr
189 void SetDeviceContext(HDC); // hsr
190
194 void SetNextWindowId(HWND);
195
201 void SetNextWindowId(void* arg) override;
202
209 void SetStereoCapableWindow(vtkTypeBool capable) override;
210
214 void MakeCurrent() override;
215
219 void ReleaseCurrent() override;
220
224 bool IsCurrent() override;
225
229 const char* ReportCapabilities() override;
230
235
242
244
247 virtual void SetupPalette(HDC hDC);
249 HDC hDC, DWORD dwFlags, int debug, int bpp = 16, int zbpp = 16);
251
255 void Clean();
256
258
264 void HideCursor() override;
265 void ShowCursor() override;
266 void SetCursorPosition(int x, int y) override;
268
272 void SetCurrentCursor(int) override;
273
274 bool DetectDPI() override;
275
277
284 void PushContext() override;
285 void PopContext() override;
287
297 bool SetSwapControl(int i) override;
298
299protected:
302
304 HPALETTE Palette;
305 HPALETTE OldPalette;
315 static const std::string DEFAULT_BASE_WINDOW_NAME;
316
317 std::stack<HGLRC> ContextStack;
318 std::stack<HDC> DCStack;
319
320 // message handler
321 virtual LRESULT MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
322
323 static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
326
328 void ResizeWhileOffscreen(int xsize, int ysize);
329 void CreateAWindow() override;
330 void DestroyWindow() override;
334
335private:
337 void operator=(const vtkWin32OpenGLRenderWindow&) = delete;
338};
339
340VTK_ABI_NAMESPACE_END
341#endif
list of point or cell ids
Definition vtkIdList.h:24
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
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?
~vtkWin32OpenGLRenderWindow() override
int * GetPosition() override
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
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 * GetGenericDisplayId() override
Dummy stubs for vtkWindow API.
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 SetIcon(vtkImageData *img) override
Set the icon displayed in the title bar and the taskbar.
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.
void SetWindowInfo(const char *) override
Set this RenderWindow's window id to a pre-existing window.
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.
void SetWindowName(const char *) override
Set the name of the window.
bool IsCurrent() override
Tells if this window is the current OpenGL context for the calling thread.
void SetNextWindowInfo(const char *) override
Sets the WindowInfo that will be used after a WindowRemap.
void Initialize() override
Initialize the rendering window.
void SetParentInfo(const char *) override
Sets the HWND id of the window that WILL BE created.
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 SetPosition(int x, int y) override
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
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(...)
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)