VTK  9.3.1
vtkXOpenGLRenderWindow.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
16 #ifndef vtkXOpenGLRenderWindow_h
17 #define vtkXOpenGLRenderWindow_h
18 
19 #include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
20 #include "vtkOpenGLRenderWindow.h"
21 #include "vtkRenderingOpenGL2Module.h" // For export macro
22 #include <X11/Xlib.h> // Needed for X types used in the public interface
23 #include <stack> // for ivar
24 
25 VTK_ABI_NAMESPACE_BEGIN
26 class vtkIdList;
27 class vtkXOpenGLRenderWindowInternal;
28 struct vtkXVisualInfo;
29 
30 class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
31 {
32 public:
33  static vtkXOpenGLRenderWindow* New();
35  void PrintSelf(ostream& os, vtkIndent indent) override;
36 
40  void Start() override;
41 
45  void Frame() override;
46 
50  virtual void WindowInitialize();
51 
58  void Initialize() override;
59 
65  void Finalize() override;
66 
70  void SetFullScreen(vtkTypeBool) override;
71 
75  void WindowRemap() override;
76 
77  // Call X funcs to map unmap
78  void SetShowWindow(bool val) override;
79 
83  virtual void PrefFullScreen();
84 
97  void SetSize(int width, int height) override;
98  void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
99 
104  VTK_DEPRECATED_IN_9_3_0("Use vtkRenderWindow::SetSize(w,h) instead")
105  void SetSizeNoXResize(int, int);
106 
108 
111  virtual Colormap GetDesiredColormap();
112  virtual Visual* GetDesiredVisual();
113  virtual vtkXVisualInfo* GetDesiredVisualInfo();
114  virtual int GetDesiredDepth();
116 
123  void SetStereoCapableWindow(vtkTypeBool capable) override;
124 
128  void MakeCurrent() override;
129 
133  bool IsCurrent() override;
134 
138  void ReleaseCurrent() override;
139 
145  void SetForceMakeCurrent() override;
146 
150  const char* ReportCapabilities() override;
151 
155  vtkTypeBool IsDirect() override;
156 
160  void* GetGenericDisplayId() override { return this->GetDisplayId(); }
161 
162  void* GetGenericWindowId() override;
163  void* GetGenericParentId() override { return reinterpret_cast<void*>(this->ParentId); }
164 
165  void* GetGenericContext() override;
166  void* GetGenericDrawable() override { return reinterpret_cast<void*>(this->WindowId); }
167 
168  void* GetGenericFBConfig();
169 
174  int* GetScreenSize() VTK_SIZEHINT(2) override;
175 
180  int* GetPosition() VTK_SIZEHINT(2) override;
181 
185  Display* GetDisplayId();
186 
188 
192  void SetDisplayId(Display*);
193  void SetDisplayId(void*) override;
195 
199  Window GetParentId();
200 
202 
205  void SetParentId(Window);
206  void SetParentId(void*) override;
208 
212  Window GetWindowId();
213 
215 
218  void SetWindowId(Window);
219  void SetWindowId(void*) override;
221 
225  void SetNextWindowId(Window);
226 
232  void SetNextWindowId(void*) override;
233 
237  void SetWindowName(const char*) override;
238 
243  void SetIcon(vtkImageData* img) override;
244 
249  bool InitializeFromCurrentContext() override;
250 
254  bool GetPlatformSupportsRenderWindowSharing() override { return true; }
255 
257 
262  void SetPosition(int x, int y) override;
263  void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
265 
267 
271  void HideCursor() override;
272  void ShowCursor() override;
274 
278  void SetCurrentCursor(int) override;
279 
285  vtkTypeBool GetEventPending() override;
286 
290  void SetWindowInfo(const char* info) override;
291 
295  void SetNextWindowInfo(const char* info) override;
296 
300  void SetParentInfo(const char* info) override;
301 
306  void Render() override;
307 
309 
316  void PushContext() override;
317  void PopContext() override;
319 
329  bool SetSwapControl(int i) override;
330 
331 protected:
333  ~vtkXOpenGLRenderWindow() override;
334 
335  vtkXOpenGLRenderWindowInternal* Internal;
336 
337  Window ParentId;
338  Window WindowId;
339  Window NextWindowId;
340  Display* DisplayId;
341  Colormap ColorMap;
347 
348  std::stack<Display*> DisplayStack;
349  std::stack<Drawable> DrawableStack;
350  std::stack<void*> ContextStack;
351 
352  // we must keep track of the cursors we are using
353  Cursor XCCrosshair;
354  Cursor XCArrow;
355  Cursor XCSizeAll;
356  Cursor XCSizeNS;
357  Cursor XCSizeWE;
358  Cursor XCSizeNE;
359  Cursor XCSizeNW;
360  Cursor XCSizeSE;
361  Cursor XCSizeSW;
362  Cursor XCHand;
363  Cursor XCCustom;
364 
365  void CreateAWindow() override;
366  void DestroyWindow() override;
367  void CloseDisplay();
368 
369 private:
371  void operator=(const vtkXOpenGLRenderWindow&) = delete;
372 };
373 
374 VTK_ABI_NAMESPACE_END
375 #endif
OpenGL rendering window.
virtual void SetFullScreen(vtkTypeBool)
Turn on/off rendering full screen window size.
vtkXOpenGLRenderWindowInternal * Internal
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
virtual void WindowRemap()
Remap the rendering window.
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...
void Render() override
Handle opengl specific code and calls superclass.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
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.
void SetWindowInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual void SetCurrentCursor(int)
Change the shape of the cursor.
virtual void SetPosition(int x, int y)
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual void Finalize()
Finalize the rendering process.
virtual void SetShowWindow(bool)
Show or not Show the window.
OpenGL rendering window.
std::stack< Display * > DisplayStack
int vtkTypeBool
Definition: vtkABI.h:64
virtual void SetNextWindowInfo(const char *)
Dummy stubs for vtkWindow API.
#define VTK_DEPRECATED_IN_9_3_0(reason)
virtual void SetSize(int width, int height)
Set the size (width and height) of the rendering window in screen coordinates (in pixels)...
void SetSize(int a[2]) override
Get the size (width and height) of the rendering window in screen coordinates (in pixels)...
std::stack< void * > ContextStack
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
void Start() override
Begin the rendering process.
topologically and geometrically regular array of data
Definition: vtkImageData.h:42
list of point or cell ids
Definition: vtkIdList.h:22
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...
void SetPosition(int a[2]) override
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
virtual int * GetScreenSize()
Get the current size of the screen in pixels.
Definition: vtkWindow.h:94
std::stack< Drawable > DrawableStack
virtual void Initialize()
Initialize the rendering window.
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...
virtual vtkTypeBool GetEventPending()
Check to see if a mouse button has been pressed.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetParentInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual void CreateAWindow()=0
Create a not-off-screen window.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.