VTK  9.0.2
vtkWin32OpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkWin32OpenGL2RenderWindow.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 =========================================================================*/
27 #ifndef vtkWin32OpenGLRenderWindow_h
28 #define vtkWin32OpenGLRenderWindow_h
29 
30 #include "vtkOpenGLRenderWindow.h"
31 #include "vtkRenderingOpenGL2Module.h" // For export macro
32 #include <stack> // for ivar
33 
34 #include "vtkWindows.h" // For windows API
35 
36 class vtkIdList;
37 
38 class VTKRENDERINGOPENGL2_EXPORT vtkWin32OpenGLRenderWindow : public vtkOpenGLRenderWindow
39 {
40 public:
43  void PrintSelf(ostream& os, vtkIndent indent) override;
44 
48  void Frame(void) override;
49 
53  virtual void WindowInitialize(void);
54 
61  void Initialize(void) override;
62 
68  void Finalize(void) override;
69 
73  void SetFullScreen(vtkTypeBool) override;
74 
78  void WindowRemap(void) override;
79 
83  void SetShowWindow(bool val) override;
84 
88  virtual void PrefFullScreen(void);
89 
91 
99  void SetSize(int width, int height) override;
100  void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
102 
107  int* GetSize() VTK_SIZEHINT(2) override;
108 
110 
115  void SetPosition(int x, int y) override;
116  void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
118 
123  int* GetScreenSize() VTK_SIZEHINT(2) override;
124 
129  int* GetPosition() VTK_SIZEHINT(2) override;
130 
135  void SetWindowName(const char*) override;
136 
140  void SetWindowInfo(const char*) override;
141 
145  void SetNextWindowInfo(const char*) override;
146 
150  void SetParentInfo(const char*) override;
151 
152  void* GetGenericDisplayId() override { return (void*)this->ContextId; }
153  void* GetGenericWindowId() override { return (void*)this->WindowId; }
154  void* GetGenericParentId() override { return (void*)this->ParentId; }
155  void* GetGenericContext() override { return (void*)this->DeviceContext; }
156  void* GetGenericDrawable() override { return (void*)this->WindowId; }
157  void SetDisplayId(void*) override;
158 
162  HWND GetWindowId();
163 
165 
168  void SetWindowId(HWND);
169  void SetWindowId(void* foo) override { this->SetWindowId((HWND)foo); }
171 
177 
181  bool GetPlatformSupportsRenderWindowSharing() override { return true; }
182 
184 
187  void SetParentId(HWND);
188  void SetParentId(void* foo) override { this->SetParentId((HWND)foo); }
190 
191  void SetContextId(HGLRC); // hsr
192  void SetDeviceContext(HDC); // hsr
193 
197  void SetNextWindowId(HWND);
198 
204  void SetNextWindowId(void* arg) override;
205 
212  void SetStereoCapableWindow(vtkTypeBool capable) override;
213 
217  void MakeCurrent() override;
218 
222  bool IsCurrent() override;
223 
227  const char* ReportCapabilities() override;
228 
232  vtkTypeBool IsDirect() override;
233 
240 
242 
245  virtual void SetupPalette(HDC hDC);
247  HDC hDC, DWORD dwFlags, int debug, int bpp = 16, int zbpp = 16);
249 
253  void Clean();
254 
256 
262  void HideCursor() override;
263  void ShowCursor() override;
264  void SetCursorPosition(int x, int y) override;
266 
270  void SetCurrentCursor(int) override;
271 
272  bool DetectDPI() override;
273 
275 
282  void PushContext() override;
283  void PopContext() override;
285 
295  bool SetSwapControl(int i) override;
296 
297 protected:
300 
302  HPALETTE Palette;
303  HPALETTE OldPalette;
304  HGLRC ContextId;
307  HWND WindowId;
308  HWND ParentId;
311 
312  std::stack<HGLRC> ContextStack;
313  std::stack<HDC> DCStack;
314 
315  // message handler
316  virtual LRESULT MessageProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
317 
318  static LRESULT APIENTRY WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
321 
323  void ResizeWhileOffscreen(int xsize, int ysize);
324  void CreateAWindow() override;
325  void DestroyWindow() override;
329 
330 private:
332  void operator=(const vtkWin32OpenGLRenderWindow&) = delete;
333 };
334 
335 #endif
list of point or cell ids
Definition: vtkIdList.h:31
a simple class to control print indentation
Definition: vtkIndent.h:34
OpenGL rendering window.
void DestroyWindow() override
Destroy a not-off-screen window.
void Clean()
Clean up device contexts, rendering contexts, etc.
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
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.
virtual void PrefFullScreen(void)
Set the preferred window size to full screen.
void WindowRemap(void) override
Remap the window.
int * GetSize() override
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
vtkTypeBool IsDirect() override
Is this render window using hardware acceleration? 0-false, 1-true.
~vtkWin32OpenGLRenderWindow() override
void Finalize(void) override
Finalize the rendering window.
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 ShowCursor() override
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.
HWND GetWindowId()
Get the window id.
void Frame(void) override
End the rendering process and display the image.
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 SetCursorPosition(int x, int y) override
bool DetectDPI() override
Attempt to detect and set the DPI of the display device by querying the system.
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.
virtual void WindowInitialize(void)
Create the window.
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.
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
virtual void SetupPixelFormatPaletteAndContext(HDC hDC, DWORD dwFlags, int debug, int bpp=16, int zbpp=16)
void SetParentId(void *foo) override
void SetNextWindowId(HWND)
Set the window id of the new window once a WindowRemap is done.
const char * ReportCapabilities() override
Get report of capabilities for the render window.
static vtkWin32OpenGLRenderWindow * New()
bool IsCurrent() override
Tells if this window is the current OpenGL context for the calling thread.
int * GetScreenSize() override
Get the current size of the screen in pixels.
void SetParentId(HWND)
Set the window's parent id to a pre-existing window.
void MakeCurrent() override
Make this windows OpenGL context the current context.
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 Initialize(void) override
Initialize the rendering window.
void CreateAWindow() override
Create a not-off-screen window.
virtual void SetupPalette(HDC hDC)
Initialize OpenGL for this window.
@ height
Definition: vtkX3D.h:260
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)