VTK  9.6.20260210
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
20#include "vtkRenderingOpenGL2Module.h" // For export macro
21#include "vtkWrappingHints.h" // For VTK_MARSHALAUTO
22#include "vtkX11Functions.h" // Needed for X types used in the public interface
23#include <stack> // for ivar
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkIdList;
27class vtkXOpenGLRenderWindowInternal;
28
29class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkXOpenGLRenderWindow
31{
32public:
35 void PrintSelf(ostream& os, vtkIndent indent) override;
36
40 void Start() override;
41
45 void Frame() override;
46
50 virtual void WindowInitialize();
51
58 void Initialize() override;
59
65 void Finalize() override;
66
70 void SetFullScreen(vtkTypeBool) override;
71
75 void WindowRemap() override;
76
77 // Call X funcs to map unmap
78 void SetShowWindow(bool val) override;
79
83 virtual void PrefFullScreen();
84
97 void SetSize(int width, int height) override;
98 void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
99
101
104 virtual Colormap GetDesiredColormap();
105 virtual Visual* GetDesiredVisual();
106 virtual vtkXVisualInfo* GetDesiredVisualInfo();
107 virtual int GetDesiredDepth();
109
116 void SetStereoCapableWindow(vtkTypeBool capable) override;
117
122 void SetCoverable(vtkTypeBool coverable) override;
123
127 void MakeCurrent() override;
128
132 bool IsCurrent() override;
133
137 void ReleaseCurrent() override;
138
144 void SetForceMakeCurrent() override;
145
149 const char* ReportCapabilities() override;
150
155
159 void* GetGenericDisplayId() override { return this->GetDisplayId(); }
160
161 void* GetGenericWindowId() override;
162 void* GetGenericParentId() override { return reinterpret_cast<void*>(this->ParentId); }
163
164 void* GetGenericContext() override;
165 void* GetGenericDrawable() override { return reinterpret_cast<void*>(this->WindowId); }
166
168
173 int* GetScreenSize() VTK_SIZEHINT(2) override;
174
179 int* GetPosition() VTK_SIZEHINT(2) override;
180
185 Display* GetDisplayId();
186
190 bool EnsureDisplay() override;
191
193
198 void SetDisplayId(Display*);
200 void SetDisplayId(void*) override;
202
207 Window GetParentId();
208
210
214 void SetParentId(Window);
216 void SetParentId(void*) override;
218
223 Window GetWindowId();
224
226
230 void SetWindowId(Window);
232 void SetWindowId(void*) override;
234
238 void SetNextWindowId(Window);
239
245 void SetNextWindowId(void*) override;
246
250 void SetWindowName(const char*) override;
251
256 void SetIcon(vtkImageData* img) override;
257
263
267 bool GetPlatformSupportsRenderWindowSharing() override { return true; }
268
270
275 void SetPosition(int x, int y) override;
276 void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
278
280
284 void HideCursor() override;
285 void ShowCursor() override;
287
291 void SetCurrentCursor(int) override;
292
299
303 void SetWindowInfo(const char* info) override;
304
308 void SetNextWindowInfo(const char* info) override;
309
313 void SetParentInfo(const char* info) override;
314
319 void Render() override;
320
322
329 void PushContext() override;
330 void PopContext() override;
332
342 bool SetSwapControl(int i) override;
343
344protected:
347
348 vtkXOpenGLRenderWindowInternal* Internal;
349
350 Window ParentId;
351 Window WindowId;
353 Display* DisplayId;
354 Colormap ColorMap;
360
361 std::stack<Display*> DisplayStack;
362 std::stack<Drawable> DrawableStack;
363 std::stack<void*> ContextStack;
364
365 // we must keep track of the cursors we are using
367 Cursor XCArrow;
368 Cursor XCSizeAll;
369 Cursor XCSizeNS;
370 Cursor XCSizeWE;
371 Cursor XCSizeNE;
372 Cursor XCSizeNW;
373 Cursor XCSizeSE;
374 Cursor XCSizeSW;
375 Cursor XCHand;
376 Cursor XCCustom;
377
378 void CreateAWindow() override;
379 void DestroyWindow() override;
381
382private:
384 void operator=(const vtkXOpenGLRenderWindow&) = delete;
385
389 bool EnsureGLX();
390};
391
392VTK_ABI_NAMESPACE_END
393#endif
list of point or cell ids
Definition vtkIdList.h:133
topologically and geometrically regular array of data
a simple class to control print indentation
Definition vtkIndent.h:108
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)