VTK  9.0.1
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 =========================================================================*/
28 #ifndef vtkXOpenGLRenderWindow_h
29 #define vtkXOpenGLRenderWindow_h
30 
31 #include "vtkOpenGLRenderWindow.h"
32 #include "vtkRenderingOpenGL2Module.h" // For export macro
33 #include <X11/Xlib.h> // Needed for X types used in the public interface
34 #include <stack> // for ivar
35 
36 class vtkIdList;
37 class vtkXOpenGLRenderWindowInternal;
38 struct vtkXVisualInfo;
39 
40 class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
41 {
42 public:
43  static vtkXOpenGLRenderWindow* New();
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
50  void Start() override;
51 
55  void Frame() override;
56 
60  virtual void WindowInitialize();
61 
68  void Initialize() override;
69 
75  void Finalize() override;
76 
80  void SetFullScreen(vtkTypeBool) override;
81 
85  void WindowRemap() override;
86 
87  // Call X funcs to map unmap
88  void SetShowWindow(bool val) override;
89 
93  virtual void PrefFullScreen();
94 
103  void SetSize(int width, int height) override;
104  void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
105 
110  void SetSizeNoXResize(int, int);
111 
113 
116  virtual Colormap GetDesiredColormap();
117  virtual Visual* GetDesiredVisual();
118  virtual vtkXVisualInfo* GetDesiredVisualInfo();
119  virtual int GetDesiredDepth();
121 
128  void SetStereoCapableWindow(vtkTypeBool capable) override;
129 
133  void MakeCurrent() override;
134 
138  bool IsCurrent() 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 
172  int* GetScreenSize() VTK_SIZEHINT(2) override;
173 
178  int* GetPosition() VTK_SIZEHINT(2) override;
179 
183  Display* GetDisplayId();
184 
186 
190  void SetDisplayId(Display*);
191  void SetDisplayId(void*) override;
193 
197  Window GetParentId();
198 
200 
203  void SetParentId(Window);
204  void SetParentId(void*) override;
206 
210  Window GetWindowId();
211 
213 
216  void SetWindowId(Window);
217  void SetWindowId(void*) override;
219 
223  void SetNextWindowId(Window);
224 
230  void SetNextWindowId(void*) override;
231 
235  void SetWindowName(const char*) override;
236 
241  bool InitializeFromCurrentContext() override;
242 
246  bool GetPlatformSupportsRenderWindowSharing() override { return true; }
247 
249 
254  void SetPosition(int x, int y) override;
255  void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
257 
259 
263  void HideCursor() override;
264  void ShowCursor() override;
266 
270  void SetCurrentCursor(int) override;
271 
277  vtkTypeBool GetEventPending() override;
278 
282  void SetWindowInfo(const char* info) override;
283 
287  void SetNextWindowInfo(const char* info) override;
288 
292  void SetParentInfo(const char* info) override;
293 
298  void Render() override;
299 
301 
308  void PushContext() override;
309  void PopContext() override;
311 
321  bool SetSwapControl(int i) override;
322 
323 protected:
325  ~vtkXOpenGLRenderWindow() override;
326 
327  vtkXOpenGLRenderWindowInternal* Internal;
328 
329  Window ParentId;
330  Window WindowId;
331  Window NextWindowId;
332  Display* DisplayId;
333  Colormap ColorMap;
339 
340  std::stack<Display*> DisplayStack;
341  std::stack<Drawable> DrawableStack;
342  std::stack<void*> ContextStack;
343 
344  // we must keep track of the cursors we are using
345  Cursor XCCrosshair;
346  Cursor XCArrow;
347  Cursor XCSizeAll;
348  Cursor XCSizeNS;
349  Cursor XCSizeWE;
350  Cursor XCSizeNE;
351  Cursor XCSizeNW;
352  Cursor XCSizeSE;
353  Cursor XCSizeSW;
354  Cursor XCHand;
355 
356  void CreateAWindow() override;
357  void DestroyWindow() override;
358  void CloseDisplay();
359 
360 private:
362  void operator=(const vtkXOpenGLRenderWindow&) = delete;
363 };
364 
365 #endif
OpenGL rendering window.
virtual void SetForceMakeCurrent()
If called, allow MakeCurrent() to skip cache-check when called.
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.
void Start(void) override
Begin the rendering process.
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 MakeCurrent() override
Attempt to make this window the current graphics context for the calling thread.
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 bool IsCurrent()
Tells if this window is the current graphics context for the calling thread.
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:69
virtual void SetStereoCapableWindow(vtkTypeBool capable)
Prescribe that the window be created in a stereo-capable mode.
virtual void SetNextWindowInfo(const char *)
Dummy stubs for vtkWindow API.
void SetSize(int a[2]) override
Set 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:33
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
list of point or cell ids
Definition: vtkIdList.h:30
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:104
std::stack< Drawable > DrawableStack
virtual void PushContext()
Ability to push and pop this window&#39;s context as the current context.
#define VTK_SIZEHINT(...)
const char * ReportCapabilities() override
Get report of capabilities for the render window.
void SetSize(int width, int height) override
Set the size (width and height) of the rendering window in screen coordinates (in pixels)...
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 Initialize(void)
Initialize the rendering window.
virtual void CreateAWindow()=0
Create a not-off-screen window.
virtual vtkTypeBool IsDirect()
Is this render window using hardware acceleration? 0-false, 1-true.
void * GetGenericDisplayId() override
Xwindow get set functions.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.