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 "vtkRenderingOpenGLModule.h" // For export macro
29 #include "vtkOpenGLRenderWindow.h"
30 #include <X11/Xlib.h> // Needed for X types used in the public interface
31 #include <X11/Xutil.h> // Needed for X types used in the public interface
32 
33 class vtkIdList;
34 class vtkXOpenGLRenderWindowInternal;
35 
36 class VTKRENDERINGOPENGL_EXPORT vtkXOpenGLRenderWindow : public vtkOpenGLRenderWindow
37 {
38 public:
39  static vtkXOpenGLRenderWindow *New();
41  void PrintSelf(ostream& os, vtkIndent indent) override;
42 
46  void Start() override;
47 
51  void Frame() override;
52 
56  virtual void WindowInitialize();
57 
64  virtual void Initialize();
65 
71  void Finalize() override;
72 
76  void SetFullScreen(int) override;
77 
81  void WindowRemap() override;
82 
86  virtual void PrefFullScreen();
87 
89 
92  void SetSize(int,int) override;
93  void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
95 
97 
100  virtual Colormap GetDesiredColormap();
101  virtual Visual *GetDesiredVisual();
102  virtual XVisualInfo *GetDesiredVisualInfo();
103  virtual int GetDesiredDepth();
105 
112  void SetStereoCapableWindow(int capable) override;
113 
117  void MakeCurrent() override;
118 
122  bool IsCurrent() override;
123 
129  void SetForceMakeCurrent() override;
130 
134  const char *ReportCapabilities() override;
135 
139  int SupportsOpenGL() override;
140 
144  int IsDirect() override;
145 
149  void *GetGenericDisplayId() override
150  {
151  return this->GetDisplayId();
152  }
153 
154  void *GetGenericWindowId() override;
155  void *GetGenericParentId() override
156  {
157  return reinterpret_cast<void *>(this->ParentId);
158  }
159 
160  void *GetGenericContext() override;
161  void *GetGenericDrawable() override
162  {
163  return reinterpret_cast<void *>(this->WindowId);
164  }
165 
169  int *GetScreenSize() override;
170 
174  int *GetPosition() override;
175 
179  Display *GetDisplayId();
180 
182 
186  void SetDisplayId(Display *);
187  void SetDisplayId(void *) override;
189 
193  Window GetParentId();
194 
196 
199  void SetParentId(Window);
200  void SetParentId(void *) override;
202 
206  Window GetWindowId();
207 
209 
212  void SetWindowId(Window);
213  void SetWindowId(void *) override;
215 
219  void SetNextWindowId(Window);
220 
226  void SetNextWindowId(void *) override;
227 
231  void SetWindowName(const char *) override;
232 
237  bool InitializeFromCurrentContext() override;
238 
240 
243  void SetPosition(int,int) override;
244  void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
246 
248 
252  void HideCursor() override;
253  void ShowCursor() override;
255 
259  void SetCurrentCursor(int) override;
260 
266  int GetEventPending() override;
267 
271  void SetWindowInfo(char *info) override;
272 
276  void SetNextWindowInfo(char *info) override;
277 
281  void SetParentInfo(char *info) override;
282 
287  void Render() override;
288 
292  void SetOffScreenRendering(int i) override;
293 
294 protected:
296  ~vtkXOpenGLRenderWindow() override;
297 
298  vtkXOpenGLRenderWindowInternal *Internal;
299 
300  Window ParentId;
301  Window WindowId;
302  Window NextWindowId;
303  Display *DisplayId;
304  Colormap ColorMap;
307  int ScreenSize[2];
312 
313  // we must keep track of the cursors we are using
314  Cursor XCCrosshair;
315  Cursor XCArrow;
316  Cursor XCSizeAll;
317  Cursor XCSizeNS;
318  Cursor XCSizeWE;
319  Cursor XCSizeNE;
320  Cursor XCSizeNW;
321  Cursor XCSizeSE;
322  Cursor XCSizeSW;
323  Cursor XCHand;
324 
325 
326  void CreateAWindow() override;
327  void DestroyWindow() override;
328  void CreateOffScreenWindow(int width, int height);
329  void DestroyOffScreenWindow();
330  void ResizeOffScreenWindow(int width, int height);
331 
332 
333 private:
335  void operator=(const vtkXOpenGLRenderWindow&) = delete;
336 };
337 
338 
339 
340 #endif
OpenGL rendering window.
virtual void SetOffScreenRendering(int)
Create a window in memory instead of on the screen.
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.
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...
bool InitializeFromCurrentContext() override
Initialize the render window from the information associated with the currently activated OpenGL cont...
virtual int * GetScreenSize()=0
Get the current size of the screen in pixels.
vtkXOpenGLRenderWindowInternal * Internal
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.
virtual void SetFullScreen(int)=0
Turn on/off rendering full screen window size.
OpenGL rendering window.
virtual int GetEventPending()=0
Check to see if a mouse button has been pressed.
virtual void SetStereoCapableWindow(int 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
Specify the size of the rendering window in pixels.
void SetWindowId(void *) override=0
Dummy stubs for vtkWindow API.
void SetDisplayId(void *) override=0
Dummy stubs for vtkWindow API.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
list of point or cell ids
Definition: vtkIdList.h:36
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.
int SupportsOpenGL() override
Does this render window support OpenGL? 0-false, 1-true.
virtual void SetNextWindowId(void *)=0
Dummy stubs for vtkWindow API.
virtual int * GetPosition()
Set/Get the position in screen coordinates of the rendering window.
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.
void SetParentId(void *) override=0
Dummy stubs for vtkWindow API.
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.
virtual void Start()=0
Initialize the rendering process.
virtual void SetWindowName(const char *)
Get name of rendering window.
void * GetGenericWindowId() override=0
Dummy stubs for vtkWindow API.
virtual void SetPosition(int, int)
Set/Get the position in screen coordinates of the rendering window.
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.