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) VTK_OVERRIDE;
43 
47  void Start() VTK_OVERRIDE;
48 
52  void Frame() VTK_OVERRIDE;
53 
57  virtual void WindowInitialize();
58 
65  void Initialize() VTK_OVERRIDE;
66 
72  void Finalize() VTK_OVERRIDE;
73 
77  virtual void SetFullScreen(int) VTK_OVERRIDE;
78 
82  void WindowRemap() VTK_OVERRIDE;
83 
87  virtual void PrefFullScreen();
88 
92  void SetSize(int,int) VTK_OVERRIDE;
93  void SetSize(int a[2]) VTK_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) VTK_OVERRIDE;
112 
116  void MakeCurrent() VTK_OVERRIDE;
117 
121  bool IsCurrent() VTK_OVERRIDE;
122 
128  void SetForceMakeCurrent() VTK_OVERRIDE;
129 
133  const char *ReportCapabilities() VTK_OVERRIDE;
134 
138  int IsDirect() VTK_OVERRIDE;
139 
143  void *GetGenericDisplayId() VTK_OVERRIDE
144  {
145  return this->GetDisplayId();
146  }
147 
148  void *GetGenericWindowId() VTK_OVERRIDE;
149  void *GetGenericParentId() VTK_OVERRIDE
150  {
151  return reinterpret_cast<void *>(this->ParentId);
152  }
153 
154  void *GetGenericContext() VTK_OVERRIDE;
155  void *GetGenericDrawable() VTK_OVERRIDE
156  {
157  return reinterpret_cast<void *>(this->WindowId);
158  }
159 
163  int *GetScreenSize() VTK_OVERRIDE;
164 
168  int *GetPosition() VTK_OVERRIDE;
169 
173  Display *GetDisplayId();
174 
176 
180  void SetDisplayId(Display *);
181  void SetDisplayId(void *) VTK_OVERRIDE;
183 
187  Window GetParentId();
188 
190 
193  void SetParentId(Window);
194  void SetParentId(void *) VTK_OVERRIDE;
196 
200  Window GetWindowId();
201 
203 
206  void SetWindowId(Window);
207  void SetWindowId(void *) VTK_OVERRIDE;
209 
213  void SetNextWindowId(Window);
214 
220  void SetNextWindowId(void *) VTK_OVERRIDE;
221 
225  void SetWindowName(const char *) VTK_OVERRIDE;
226 
231  bool InitializeFromCurrentContext() VTK_OVERRIDE;
232 
234 
237  void SetPosition(int,int) VTK_OVERRIDE;
238  void SetPosition(int a[2]) VTK_OVERRIDE { this->SetPosition(a[0], a[1]); }
240 
242 
246  void HideCursor() VTK_OVERRIDE;
247  void ShowCursor() VTK_OVERRIDE;
249 
253  void SetCurrentCursor(int) VTK_OVERRIDE;
254 
260  int GetEventPending() VTK_OVERRIDE;
261 
265  void SetWindowInfo(char *info) VTK_OVERRIDE;
266 
270  void SetNextWindowInfo(char *info) VTK_OVERRIDE;
271 
275  void SetParentInfo(char *info) VTK_OVERRIDE;
276 
281  void Render() VTK_OVERRIDE;
282 
286  void SetOffScreenRendering(int i) VTK_OVERRIDE;
287 
289 
296  void PushContext() VTK_OVERRIDE;
297  void PopContext() VTK_OVERRIDE;
299 
300 protected:
302  ~vtkXOpenGLRenderWindow() VTK_OVERRIDE;
303 
304  vtkXOpenGLRenderWindowInternal *Internal;
305 
306  Window ParentId;
307  Window WindowId;
308  Window NextWindowId;
309  Display *DisplayId;
310  Colormap ColorMap;
311  int OwnWindow;
312  int OwnDisplay;
313  int ScreenSize[2];
314  int CursorHidden;
315  int ForceMakeCurrent;
316  int UsingHardware;
317 
318  std::stack<Display *> DisplayStack;
319  std::stack<Drawable> DrawableStack;
320  std::stack<void *> ContextStack;
321 
322  // we must keep track of the cursors we are using
323  Cursor XCCrosshair;
324  Cursor XCArrow;
325  Cursor XCSizeAll;
326  Cursor XCSizeNS;
327  Cursor XCSizeWE;
328  Cursor XCSizeNE;
329  Cursor XCSizeNW;
330  Cursor XCSizeSE;
331  Cursor XCSizeSW;
332  Cursor XCHand;
333 
334 
335  void CreateAWindow() VTK_OVERRIDE;
336  void DestroyWindow() VTK_OVERRIDE;
337  void CreateOffScreenWindow(int width, int height);
338  void DestroyOffScreenWindow();
339  void ResizeOffScreenWindow(int width, int height);
340  void CloseDisplay();
341 
342 
343 private:
344  vtkXOpenGLRenderWindow(const vtkXOpenGLRenderWindow&) VTK_DELETE_FUNCTION;
345  void operator=(const vtkXOpenGLRenderWindow&) VTK_DELETE_FUNCTION;
346 };
347 
348 
349 
350 #endif
OpenGL rendering window.
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...
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.
OpenGL rendering window.
virtual void SetStereoCapableWindow(int capable)
Prescribe that the window be created in a stereo-capable mode.
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
list of point or cell ids
Definition: vtkIdList.h:30
void SetPosition(int a[2]) override
Move the window to a new position on the display.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void Start()=0
Initialize the rendering process.
void * GetGenericWindowId() override=0
Dummy stubs for vtkWindow API.
void MakeCurrent() override=0
Attempt to make this window the current graphics context for the calling thread.