VTK  9.4.20251007
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
15
16#ifndef vtkXOpenGLRenderWindow_h
17#define vtkXOpenGLRenderWindow_h
18
19#include "vtkDeprecation.h" // For VTK_DEPRECATED_IN_9_3_0
21#include "vtkRenderingOpenGL2Module.h" // For export macro
22#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
23#include <X11/Xlib.h> // Needed for X types used in the public interface
24#include <stack> // for ivar
25
26VTK_ABI_NAMESPACE_BEGIN
27class vtkIdList;
28class vtkXOpenGLRenderWindowInternal;
29struct vtkXVisualInfo;
30
31class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkXOpenGLRenderWindow
33{
34public:
37 void PrintSelf(ostream& os, vtkIndent indent) override;
38
42 void Start() override;
43
47 void Frame() override;
48
52 virtual void WindowInitialize();
53
60 void Initialize() override;
61
67 void Finalize() override;
68
72 void SetFullScreen(vtkTypeBool) override;
73
77 void WindowRemap() override;
78
79 // Call X funcs to map unmap
80 void SetShowWindow(bool val) override;
81
85 virtual void PrefFullScreen();
86
99 void SetSize(int width, int height) override;
100 void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
101
106 VTK_DEPRECATED_IN_9_3_0("Use vtkRenderWindow::SetSize(w,h) instead")
107 void SetSizeNoXResize(int, int);
108
110
113 virtual Colormap GetDesiredColormap();
114 virtual Visual* GetDesiredVisual();
115 virtual vtkXVisualInfo* GetDesiredVisualInfo();
116 virtual int GetDesiredDepth();
118
125 void SetStereoCapableWindow(vtkTypeBool capable) override;
126
130 void MakeCurrent() override;
131
135 bool IsCurrent() override;
136
140 void ReleaseCurrent() override;
141
147 void SetForceMakeCurrent() override;
148
152 const char* ReportCapabilities() override;
153
158
162 void* GetGenericDisplayId() override { return this->GetDisplayId(); }
163
164 void* GetGenericWindowId() override;
165 void* GetGenericParentId() override { return reinterpret_cast<void*>(this->ParentId); }
166
167 void* GetGenericContext() override;
168 void* GetGenericDrawable() override { return reinterpret_cast<void*>(this->WindowId); }
169
171
176 int* GetScreenSize() VTK_SIZEHINT(2) override;
177
182 int* GetPosition() VTK_SIZEHINT(2) override;
183
188 Display* GetDisplayId();
189
193 bool EnsureDisplay() override;
194
196
201 void SetDisplayId(Display*);
203 void SetDisplayId(void*) override;
205
210 Window GetParentId();
211
213
217 void SetParentId(Window);
219 void SetParentId(void*) override;
221
226 Window GetWindowId();
227
229
233 void SetWindowId(Window);
235 void SetWindowId(void*) override;
237
241 void SetNextWindowId(Window);
242
248 void SetNextWindowId(void*) override;
249
253 void SetWindowName(const char*) override;
254
259 void SetIcon(vtkImageData* img) override;
260
266
270 bool GetPlatformSupportsRenderWindowSharing() override { return true; }
271
273
278 void SetPosition(int x, int y) override;
279 void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
281
283
287 void HideCursor() override;
288 void ShowCursor() override;
290
294 void SetCurrentCursor(int) override;
295
302
306 void SetWindowInfo(const char* info) override;
307
311 void SetNextWindowInfo(const char* info) override;
312
316 void SetParentInfo(const char* info) override;
317
322 void Render() override;
323
325
332 void PushContext() override;
333 void PopContext() override;
335
345 bool SetSwapControl(int i) override;
346
347protected:
350
351 vtkXOpenGLRenderWindowInternal* Internal;
352
353 Window ParentId;
354 Window WindowId;
356 Display* DisplayId;
357 Colormap ColorMap;
363
364 std::stack<Display*> DisplayStack;
365 std::stack<Drawable> DrawableStack;
366 std::stack<void*> ContextStack;
367
368 // we must keep track of the cursors we are using
370 Cursor XCArrow;
371 Cursor XCSizeAll;
372 Cursor XCSizeNS;
373 Cursor XCSizeWE;
374 Cursor XCSizeNE;
375 Cursor XCSizeNW;
376 Cursor XCSizeSE;
377 Cursor XCSizeSW;
378 Cursor XCHand;
379 Cursor XCCustom;
380
381 void CreateAWindow() override;
382 void DestroyWindow() override;
384
385private:
387 void operator=(const vtkXOpenGLRenderWindow&) = delete;
388
392 bool EnsureGLX();
393};
394
395VTK_ABI_NAMESPACE_END
396#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 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.
void SetSizeNoXResize(int, int)
Specify the size of the rendering window in pixels but do not resize the XWindow.
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_DEPRECATED_IN_9_3_0(reason)
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)