VTK  9.1.0
vtkXOpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkXOpenGLRenderWindow.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 =========================================================================*/
25 #ifndef vtkXOpenGLRenderWindow_h
26 #define vtkXOpenGLRenderWindow_h
27 
28 #include "vtkOpenGLRenderWindow.h"
29 #include "vtkRenderingOpenGL2Module.h" // For export macro
30 #include <X11/Xlib.h> // Needed for X types used in the public interface
31 #include <stack> // for ivar
32 
33 class vtkIdList;
34 class vtkXOpenGLRenderWindowInternal;
35 struct vtkXVisualInfo;
36 
37 class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
38 {
39 public:
42  void PrintSelf(ostream& os, vtkIndent indent) override;
43 
47  void Start() override;
48 
52  void Frame() override;
53 
57  virtual void WindowInitialize();
58 
65  void Initialize() override;
66 
72  void Finalize() override;
73 
77  void SetFullScreen(vtkTypeBool) override;
78 
82  void WindowRemap() override;
83 
84  // Call X funcs to map unmap
85  void SetShowWindow(bool val) override;
86 
90  virtual void PrefFullScreen();
91 
100  void SetSize(int width, int height) override;
101  void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
102 
107  void SetSizeNoXResize(int, int);
108 
110 
113  virtual Colormap GetDesiredColormap();
114  virtual Visual* GetDesiredVisual();
115  virtual vtkXVisualInfo* GetDesiredVisualInfo();
116  virtual int GetDesiredDepth();
118 
125  void SetStereoCapableWindow(vtkTypeBool capable) override;
126 
130  void MakeCurrent() override;
131 
135  bool IsCurrent() override;
136 
140  void ReleaseCurrent() override;
141 
147  void SetForceMakeCurrent() override;
148 
152  const char* ReportCapabilities() override;
153 
157  vtkTypeBool IsDirect() override;
158 
162  void* GetGenericDisplayId() override { return this->GetDisplayId(); }
163 
164  void* GetGenericWindowId() override;
165  void* GetGenericParentId() override { return reinterpret_cast<void*>(this->ParentId); }
166 
167  void* GetGenericContext() override;
168  void* GetGenericDrawable() override { return reinterpret_cast<void*>(this->WindowId); }
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 
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:
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 #endif
list of point or cell ids
Definition: vtkIdList.h:31
topologically and geometrically regular array of data
Definition: vtkImageData.h:48
a simple class to control print indentation
Definition: vtkIndent.h:34
OpenGL rendering window.
OpenGL rendering window.
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...
bool IsCurrent() override
Tells if this window is the current OpenGL context for the calling thread.
vtkTypeBool IsDirect() override
Is this render window using hardware acceleration? 0-false, 1-true.
void DestroyWindow() override
Destroy a not-off-screen window.
void PopContext() override
Ability to push and pop this window's context as the current context.
void SetForceMakeCurrent() override
If called, allow MakeCurrent() to skip cache-check when called.
virtual Colormap GetDesiredColormap()
Get the X properties of an ideal rendering window.
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 Initialize() override
Initialize the rendering window.
void SetSize(int a[2]) override
Get the size (width and height) of the rendering window in screen coordinates (in pixels).
void ReleaseCurrent() override
Release 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 CreateAWindow() override
Create a not-off-screen window.
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
void SetParentInfo(const char *info) override
Sets the X window id of the window that WILL BE created.
void Start() override
Begin the rendering process.
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.
virtual int GetDesiredDepth()
Get the X properties of an ideal rendering window.
void MakeCurrent() override
Make this window the current OpenGL context.
vtkTypeBool GetEventPending() override
Check to see if a mouse button has been pressed or mouse wheel activated.
void SetWindowInfo(const char *info) override
Set this RenderWindow's X window id to a pre-existing window.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetCurrentCursor(int) override
Change the shape of the cursor.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
void SetSizeNoXResize(int, int)
Specify the size of the rendering window in pixels but do not resize the XWindow.
virtual Visual * GetDesiredVisual()
Get the X properties of an ideal rendering window.
int * GetScreenSize() override
Get the current size of the screen in pixels.
vtkXOpenGLRenderWindowInternal * Internal
const char * ReportCapabilities() override
Get report of capabilities for the render window.
void Finalize() override
"Deinitialize" the rendering window.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
void SetNextWindowInfo(const char *info) override
Set the window info that will be used after WindowRemap()
void Frame() override
End the rendering process and display the image.
std::stack< Drawable > DrawableStack
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
~vtkXOpenGLRenderWindow() override
virtual vtkXVisualInfo * GetDesiredVisualInfo()
Get the X properties of an ideal rendering window.
static vtkXOpenGLRenderWindow * New()
virtual void PrefFullScreen()
Set the preferred window size to full screen.
void WindowRemap() override
Resize the window.
void SetStereoCapableWindow(vtkTypeBool capable) override
Prescribe that the window be created in a stereo-capable mode.
virtual void WindowInitialize()
Initialize the window for rendering.
void SetPosition(int a[2]) override
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
std::stack< void * > ContextStack
void Render() override
This computes the size of the render window before calling the supper classes render.
void SetPosition(int x, int y) override
Set the position (x and y) of the rendering window in screen coordinates (in pixels).
std::stack< Display * > DisplayStack
void SetShowWindow(bool val) override
Show or not Show the window.
void PushContext() override
Ability to push and pop this window's context as the current context.
void * GetGenericDisplayId() override
Xwindow get set functions.
@ info
Definition: vtkX3D.h:382
@ height
Definition: vtkX3D.h:260
int vtkTypeBool
Definition: vtkABI.h:69
#define VTK_SIZEHINT(...)