VTK  9.5.2
vtkXOpenGLRenderWindow.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
12
13#ifndef vtkXOpenGLRenderWindow_h
14#define vtkXOpenGLRenderWindow_h
15
17#include "vtkRenderingOpenGL2Module.h" // For export macro
18#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
19#include <X11/Xlib.h> // Needed for X types used in the public interface
20#include <stack> // for ivar
21
22VTK_ABI_NAMESPACE_BEGIN
23class vtkIdList;
24class vtkXOpenGLRenderWindowInternal;
25struct vtkXVisualInfo;
26
27class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkXOpenGLRenderWindow
29{
30public:
33 void PrintSelf(ostream& os, vtkIndent indent) override;
34
38 void Start() override;
39
43 void Frame() override;
44
48 virtual void WindowInitialize();
49
56 void Initialize() override;
57
63 void Finalize() override;
64
68 void SetFullScreen(vtkTypeBool) override;
69
73 void WindowRemap() override;
74
75 // Call X funcs to map unmap
76 void SetShowWindow(bool val) override;
77
81 virtual void PrefFullScreen();
82
95 void SetSize(int width, int height) override;
96 void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
97
99
102 virtual Colormap GetDesiredColormap();
103 virtual Visual* GetDesiredVisual();
104 virtual vtkXVisualInfo* GetDesiredVisualInfo();
105 virtual int GetDesiredDepth();
107
114 void SetStereoCapableWindow(vtkTypeBool capable) override;
115
120 void SetCoverable(vtkTypeBool coverable) override;
121
125 void MakeCurrent() override;
126
130 bool IsCurrent() override;
131
135 void ReleaseCurrent() override;
136
142 void SetForceMakeCurrent() override;
143
147 const char* ReportCapabilities() override;
148
153
157 void* GetGenericDisplayId() override { return this->GetDisplayId(); }
158
159 void* GetGenericWindowId() override;
160 void* GetGenericParentId() override { return reinterpret_cast<void*>(this->ParentId); }
161
162 void* GetGenericContext() override;
163 void* GetGenericDrawable() override { return reinterpret_cast<void*>(this->WindowId); }
164
166
171 int* GetScreenSize() VTK_SIZEHINT(2) override;
172
177 int* GetPosition() VTK_SIZEHINT(2) override;
178
183 Display* GetDisplayId();
184
188 bool EnsureDisplay() override;
189
191
196 void SetDisplayId(Display*);
198 void SetDisplayId(void*) override;
200
205 Window GetParentId();
206
208
212 void SetParentId(Window);
214 void SetParentId(void*) override;
216
221 Window GetWindowId();
222
224
228 void SetWindowId(Window);
230 void SetWindowId(void*) override;
232
236 void SetNextWindowId(Window);
237
243 void SetNextWindowId(void*) override;
244
248 void SetWindowName(const char*) override;
249
254 void SetIcon(vtkImageData* img) override;
255
261
265 bool GetPlatformSupportsRenderWindowSharing() override { return true; }
266
268
273 void SetPosition(int x, int y) override;
274 void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
276
278
282 void HideCursor() override;
283 void ShowCursor() override;
285
289 void SetCurrentCursor(int) override;
290
297
301 void SetWindowInfo(const char* info) override;
302
306 void SetNextWindowInfo(const char* info) override;
307
311 void SetParentInfo(const char* info) override;
312
317 void Render() override;
318
320
327 void PushContext() override;
328 void PopContext() override;
330
340 bool SetSwapControl(int i) override;
341
342protected:
345
346 vtkXOpenGLRenderWindowInternal* Internal;
347
348 Window ParentId;
349 Window WindowId;
351 Display* DisplayId;
352 Colormap ColorMap;
358
359 std::stack<Display*> DisplayStack;
360 std::stack<Drawable> DrawableStack;
361 std::stack<void*> ContextStack;
362
363 // we must keep track of the cursors we are using
365 Cursor XCArrow;
366 Cursor XCSizeAll;
367 Cursor XCSizeNS;
368 Cursor XCSizeWE;
369 Cursor XCSizeNE;
370 Cursor XCSizeNW;
371 Cursor XCSizeSE;
372 Cursor XCSizeSW;
373 Cursor XCHand;
374 Cursor XCCustom;
375
376 void CreateAWindow() override;
377 void DestroyWindow() override;
379
380private:
382 void operator=(const vtkXOpenGLRenderWindow&) = delete;
383
387 bool EnsureGLX();
388};
389
390VTK_ABI_NAMESPACE_END
391#endif
list of point or cell ids
Definition vtkIdList.h:24
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:29
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
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?
int * GetPosition() override
Get the position (x and y) of the rendering window in screen coordinates (in pixels).
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.
int * GetScreenSize() override
Get the current size of the screen in pixels.
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 * GetGenericParentId() override
Dummy stubs for vtkWindow API.
const char * ReportCapabilities() override
Get report of capabilities for the render window.
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 SetNextWindowId(Window)
Specify the X window id to use if a WindowRemap is done.
void ReleaseCurrent() override
Release the current context.
void SetSize(int width, int height) override
Set the size (width and height in pixels) of the rendering window.
virtual Visual * GetDesiredVisual()
Get the X properties of an ideal rendering window.
void CreateAWindow() override
Create a not-off-screen window.
Window GetParentId()
Get this RenderWindow's parent X window id.
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 * GetGenericDisplayId() override
Xwindow get set functions.
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.
Window GetWindowId()
Get this RenderWindow's X window id.
Display * GetDisplayId()
Get this RenderWindow's X display id.
void SetCoverable(vtkTypeBool coverable) override
Set whether this xwindow should be coverable by other windows, as opposed to always on top.
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 SetWindowName(const char *) override
Set name of rendering window.
vtkXOpenGLRenderWindowInternal * Internal
void Finalize() override
"Deinitialize" the rendering window.
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
~vtkXOpenGLRenderWindow() override
bool GetPlatformSupportsRenderWindowSharing() override
Does this platform support render window data sharing.
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 SetDisplayId(Display *)
Set the X display id for this RenderWindow to use to a pre-existing X display id.
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
bool EnsureDisplay() override
Ensure RenderWindow's X display is opened.
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).
static vtkXOpenGLRenderWindow * New()
std::stack< Display * > DisplayStack
bool InitializeFromCurrentContext() override
Initialize the render window from the information associated with the currently activated OpenGL cont...
void SetParentId(Window)
Sets the parent of the window that WILL BE created.
void SetIcon(vtkImageData *img) override
For window manager that supports it, set the icon displayed in the taskbar and the title bar.
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.
virtual vtkXVisualInfo * GetDesiredVisualInfo()
Get the X properties of an ideal rendering window.
void SetWindowId(Window)
Set this RenderWindow's X window id to a pre-existing window.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)