VTK  9.4.20250413
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
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 <X11/Xlib.h> // Needed for X types used in the public interface
23#include <stack> // for ivar
24
25VTK_ABI_NAMESPACE_BEGIN
26class vtkIdList;
27class vtkXOpenGLRenderWindowInternal;
28struct vtkXVisualInfo;
29
30class VTKRENDERINGOPENGL2_EXPORT VTK_MARSHALAUTO vtkXOpenGLRenderWindow
32{
33public:
36 void PrintSelf(ostream& os, vtkIndent indent) override;
37
41 void Start() override;
42
46 void Frame() override;
47
51 virtual void WindowInitialize();
52
59 void Initialize() override;
60
66 void Finalize() override;
67
71 void SetFullScreen(vtkTypeBool) override;
72
76 void WindowRemap() override;
77
78 // Call X funcs to map unmap
79 void SetShowWindow(bool val) override;
80
84 virtual void PrefFullScreen();
85
98 void SetSize(int width, int height) override;
99 void SetSize(int a[2]) override { this->SetSize(a[0], a[1]); }
100
102
105 virtual Colormap GetDesiredColormap();
106 virtual Visual* GetDesiredVisual();
107 virtual vtkXVisualInfo* GetDesiredVisualInfo();
108 virtual int GetDesiredDepth();
110
117 void SetStereoCapableWindow(vtkTypeBool capable) override;
118
123 void SetCoverable(vtkTypeBool coverable) override;
124
128 void MakeCurrent() override;
129
133 bool IsCurrent() override;
134
138 void ReleaseCurrent() override;
139
145 void SetForceMakeCurrent() override;
146
150 const char* ReportCapabilities() override;
151
156
160 void* GetGenericDisplayId() override { return this->GetDisplayId(); }
161
162 void* GetGenericWindowId() override;
163 void* GetGenericParentId() override { return reinterpret_cast<void*>(this->ParentId); }
164
165 void* GetGenericContext() override;
166 void* GetGenericDrawable() override { return reinterpret_cast<void*>(this->WindowId); }
167
169
174 int* GetScreenSize() VTK_SIZEHINT(2) override;
175
180 int* GetPosition() VTK_SIZEHINT(2) override;
181
186 Display* GetDisplayId();
187
191 bool EnsureDisplay() override;
192
194
199 void SetDisplayId(Display*);
201 void SetDisplayId(void*) override;
203
208 Window GetParentId();
209
211
215 void SetParentId(Window);
217 void SetParentId(void*) override;
219
224 Window GetWindowId();
225
227
231 void SetWindowId(Window);
233 void SetWindowId(void*) override;
235
239 void SetNextWindowId(Window);
240
246 void SetNextWindowId(void*) override;
247
251 void SetWindowName(const char*) override;
252
257 void SetIcon(vtkImageData* img) override;
258
263 bool InitializeFromCurrentContext() override;
264
268 bool GetPlatformSupportsRenderWindowSharing() override { return true; }
269
271
276 void SetPosition(int x, int y) override;
277 void SetPosition(int a[2]) override { this->SetPosition(a[0], a[1]); }
279
281
285 void HideCursor() override;
286 void ShowCursor() override;
288
292 void SetCurrentCursor(int) override;
293
300
304 void SetWindowInfo(const char* info) override;
305
309 void SetNextWindowInfo(const char* info) override;
310
314 void SetParentInfo(const char* info) override;
315
320 void Render() override;
321
323
330 void PushContext() override;
331 void PopContext() override;
333
343 bool SetSwapControl(int i) override;
344
345protected:
348
349 vtkXOpenGLRenderWindowInternal* Internal;
350
351 Window ParentId;
352 Window WindowId;
354 Display* DisplayId;
355 Colormap ColorMap;
361
362 std::stack<Display*> DisplayStack;
363 std::stack<Drawable> DrawableStack;
364 std::stack<void*> ContextStack;
365
366 // we must keep track of the cursors we are using
368 Cursor XCArrow;
369 Cursor XCSizeAll;
370 Cursor XCSizeNS;
371 Cursor XCSizeWE;
372 Cursor XCSizeNE;
373 Cursor XCSizeNW;
374 Cursor XCSizeSE;
375 Cursor XCSizeSW;
376 Cursor XCHand;
377 Cursor XCCustom;
378
379 void CreateAWindow() override;
380 void DestroyWindow() override;
382
383private:
385 void operator=(const vtkXOpenGLRenderWindow&) = delete;
386};
387
388VTK_ABI_NAMESPACE_END
389#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
OpenGL rendering window.
OpenGL rendering window.
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? 0-false, 1-true.
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 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.
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.
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.
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
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 * GetGenericContext() override
Dummy stubs for vtkWindow API.
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
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.
int vtkTypeBool
Definition vtkABI.h:64
#define VTK_SIZEHINT(...)
#define VTK_MARSHAL_EXCLUDE_REASON_NOT_SUPPORTED
#define VTK_MARSHALAUTO
#define VTK_MARSHALEXCLUDE(reason)