VTK
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 "vtkRenderingOpenGL2Module.h" // For export macro
29 #include <stack> // for ivar
30 #include "vtkOpenGLRenderWindow.h"
31 #include <X11/Xlib.h> // Needed for X types used in the public interface
32 #include <X11/Xutil.h> // Needed for X types used in the public interface
33 
34 class vtkIdList;
35 class vtkXOpenGLRenderWindowInternal;
36 
37 class VTKRENDERINGOPENGL2_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
38 {
39 public:
40  static vtkXOpenGLRenderWindow *New();
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(int) override;
78 
82  void WindowRemap() override;
83 
87  virtual void PrefFullScreen();
88 
92  void SetSize(int,int) override;
93  void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
94 
96 
99  virtual Colormap GetDesiredColormap();
100  virtual Visual *GetDesiredVisual();
101  virtual XVisualInfo *GetDesiredVisualInfo();
102  virtual int GetDesiredDepth();
104 
111  void SetStereoCapableWindow(int capable) override;
112 
116  void MakeCurrent() override;
117 
121  bool IsCurrent() override;
122 
128  void SetForceMakeCurrent() override;
129 
133  const char *ReportCapabilities() override;
134 
138  int IsDirect() override;
139 
143  void *GetGenericDisplayId() override
144  {
145  return this->GetDisplayId();
146  }
147 
148  void *GetGenericWindowId() override;
149  void *GetGenericParentId() override
150  {
151  return reinterpret_cast<void *>(this->ParentId);
152  }
153 
154  void *GetGenericContext() override;
155  void *GetGenericDrawable() override
156  {
157  return reinterpret_cast<void *>(this->WindowId);
158  }
159 
163  int *GetScreenSize() VTK_SIZEHINT(2) override;
164 
168  int *GetPosition() VTK_SIZEHINT(2) override;
169 
173  Display *GetDisplayId();
174 
176 
180  void SetDisplayId(Display *);
181  void SetDisplayId(void *) override;
183 
187  Window GetParentId();
188 
190 
193  void SetParentId(Window);
194  void SetParentId(void *) override;
196 
200  Window GetWindowId();
201 
203 
206  void SetWindowId(Window);
207  void SetWindowId(void *) override;
209 
213  void SetNextWindowId(Window);
214 
220  void SetNextWindowId(void *) override;
221 
225  void SetWindowName(const char *) override;
226 
231  bool InitializeFromCurrentContext() override;
232 
234 
237  void SetPosition(int,int) override;
238  void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
240 
242 
246  void HideCursor() override;
247  void ShowCursor() override;
249 
253  void SetCurrentCursor(int) override;
254 
260  int GetEventPending() override;
261 
265  void SetWindowInfo(char *info) override;
266 
270  void SetNextWindowInfo(char *info) override;
271 
275  void SetParentInfo(char *info) override;
276 
281  void Render() override;
282 
286  void SetOffScreenRendering(int i) override;
287 
289 
296  void PushContext() override;
297  void PopContext() override;
299 
309  bool SetSwapControl(int i) override;
310 
311 protected:
313  ~vtkXOpenGLRenderWindow() override;
314 
315  vtkXOpenGLRenderWindowInternal *Internal;
316 
317  Window ParentId;
318  Window WindowId;
319  Window NextWindowId;
320  Display *DisplayId;
321  Colormap ColorMap;
324  int ScreenSize[2];
328 
329  std::stack<Display *> DisplayStack;
330  std::stack<Drawable> DrawableStack;
331  std::stack<void *> ContextStack;
332 
333  // we must keep track of the cursors we are using
334  Cursor XCCrosshair;
335  Cursor XCArrow;
336  Cursor XCSizeAll;
337  Cursor XCSizeNS;
338  Cursor XCSizeWE;
339  Cursor XCSizeNE;
340  Cursor XCSizeNW;
341  Cursor XCSizeSE;
342  Cursor XCSizeSW;
343  Cursor XCHand;
344 
345 
346  void CreateAWindow() override;
347  void DestroyWindow() override;
348  void CreateOffScreenWindow(int width, int height);
349  void DestroyOffScreenWindow();
350  void ResizeOffScreenWindow(int width, int height);
351  void CloseDisplay();
352 
353 
354 private:
356  void operator=(const vtkXOpenGLRenderWindow&) = delete;
357 };
358 
359 
360 
361 #endif
OpenGL rendering window.
virtual void Finalize()=0
Finalize the rendering process.
virtual void SetForceMakeCurrent()
If called, allow MakeCurrent() to skip cache-check when called.
virtual void WindowRemap()=0
Remap the rendering window.
vtkXOpenGLRenderWindowInternal * Internal
virtual void HideCursor()=0
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
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...
virtual int * GetScreenSize()=0
Get the current size of the screen in pixels.
void * GetGenericContext() override=0
Dummy stubs for vtkWindow API.
virtual void SetCurrentCursor(int)
Change the shape of the cursor.
void Render() override
Ask each renderer owned by this RenderWindow to render its image and synchronize this process...
virtual void SetNextWindowInfo(char *)=0
Dummy stubs for vtkWindow API.
OpenGL rendering window.
virtual int GetEventPending()=0
Check to see if a mouse button has been pressed.
virtual void SetStereoCapableWindow(vtkTypeBool capable)
Prescribe that the window be created in a stereo-capable mode.
virtual int IsDirect()
Is this render window using hardware acceleration? 0-false, 1-true.
virtual bool IsCurrent()=0
Tells if this window is the current graphics context for the calling thread.
void SetSize(int a[2]) override
Set the size of the window in screen coordinates in pixels.
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
std::stack< Display * > DisplayStack
list of point or cell ids
Definition: vtkIdList.h:30
void SetWindowInfo(char *) override=0
Dummy stubs for vtkWindow API.
void SetPosition(int a[2]) override
Move the window to a new position on the display.
std::stack< Drawable > DrawableStack
virtual void SetOffScreenRendering(vtkTypeBool)
Create a window in memory instead of on the screen.
virtual void PushContext()
Ability to push and pop this window&#39;s context as the current context.
#define VTK_SIZEHINT(...)
virtual void Frame()=0
A termination method performed at the end of the rendering process to do things like swapping buffers...
const char * ReportCapabilities() override
Get report of capabilities for the render window.
virtual bool SetSwapControl(int)
Set the number of vertical syncs required between frames.
virtual void SetFullScreen(vtkTypeBool)=0
Turn on/off rendering full screen window size.
void SetParentInfo(char *) override=0
Dummy stubs for vtkWindow API.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void SetSize(int a[2]) override
Set the size of the window in screen coordinates in pixels.
std::stack< void * > ContextStack
virtual void Start()=0
Initialize the rendering process.
void * GetGenericWindowId() override=0
Dummy stubs for vtkWindow API.
virtual void Initialize(void)
Initialize the rendering window.
virtual void CreateAWindow()=0
Create a not-off-screen window.
void MakeCurrent() override=0
Attempt to make this window the current graphics context for the calling thread.
virtual void ShowCursor()=0
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
void * GetGenericDisplayId() override
Xwindow get set functions.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.