VTK  9.3.1
vtkGenericOpenGLRenderWindow.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
24 #ifndef vtkGenericOpenGLRenderWindow_h
25 #define vtkGenericOpenGLRenderWindow_h
26 
27 #include "vtkOpenGLRenderWindow.h"
28 #include "vtkRenderingOpenGL2Module.h" // For export macro
29 
30 VTK_ABI_NAMESPACE_BEGIN
31 class VTKRENDERINGOPENGL2_EXPORT vtkGenericOpenGLRenderWindow : public vtkOpenGLRenderWindow
32 {
33 public:
36  void PrintSelf(ostream& os, vtkIndent indent) override;
37 
38 protected:
40  ~vtkGenericOpenGLRenderWindow() override;
41 
42 public:
44  void Finalize() override;
45 
48  void Frame() override;
49 
52  void MakeCurrent() override;
53 
57  bool IsCurrent() override;
58 
62  int SupportsOpenGL() override;
63 
67  vtkTypeBool IsDirect() override;
68 
69  // {@
71  void SetFrontLeftBuffer(unsigned int);
72  void SetFrontRightBuffer(unsigned int);
73  void SetBackLeftBuffer(unsigned int);
74  void SetBackRightBuffer(unsigned int);
75  // }@
76 
77  void SetOwnContext(vtkTypeBool);
78 
80  void PushState() {}
82  void PopState() {}
83 
84  // {@
86  void SetWindowId(void*) override;
87  void* GetGenericWindowId() override;
88  void SetDisplayId(void*) override;
89  void SetParentId(void*) override;
90  void* GetGenericDisplayId() override;
91  void* GetGenericParentId() override;
92  void* GetGenericContext() override;
93  void* GetGenericDrawable() override;
94  void SetWindowInfo(const char*) override;
95  void SetParentInfo(const char*) override;
96  int* GetScreenSize() VTK_SIZEHINT(2) override;
97  void HideCursor() override;
98  void ShowCursor() override;
99  void SetFullScreen(vtkTypeBool) override;
100  void WindowRemap() override;
101  vtkTypeBool GetEventPending() override;
102  void SetNextWindowId(void*) override;
103  void SetNextWindowInfo(const char*) override;
104  void CreateAWindow() override;
105  void DestroyWindow() override;
106  // }@
107 
109 
113  void SetIsDirect(vtkTypeBool newValue);
114  void SetSupportsOpenGL(int newValue);
115  void SetIsCurrent(bool newValue);
117 
125  void Render() override;
126 
130  float GetMaximumHardwareLineWidth() override;
131 
133 
137  vtkSetClampMacro(ForceMaximumHardwareLineWidth, float, 0, VTK_FLOAT_MAX);
138  vtkGetMacro(ForceMaximumHardwareLineWidth, float);
140 
142 
147  vtkSetMacro(ReadyForRendering, bool);
148  vtkGetMacro(ReadyForRendering, bool);
149 
154  vtkSetVector2Macro(ScreenSize, int);
155 
159  void SetCurrentCursor(int cShape) override;
160 
161  // since we are using an external context it must
162  // specify if the window is mapped or not.
163  vtkSetMacro(Mapped, vtkTypeBool);
164 
168  void OpenGLInit() override;
169 
170 protected:
176  int ReadPixels(
177  const vtkRecti& rect, int front, int glFormat, int glType, void* data, int right) override;
178 
179  int SetPixelData(
180  int x1, int y1, int x2, int y2, unsigned char* data, int front, int right) override;
181  int SetPixelData(
182  int x1, int y1, int x2, int y2, vtkUnsignedCharArray* data, int front, int right) override;
183  int SetRGBACharPixelData(
184  int x1, int y1, int x2, int y2, unsigned char* data, int front, int blend, int right) override;
185  int SetRGBACharPixelData(int x, int y, int x2, int y2, vtkUnsignedCharArray* data, int front,
186  int blend = 0, int right = 0) override;
187 
188  int DirectStatus;
189  int SupportsOpenGLStatus;
190  bool CurrentStatus;
191  float ForceMaximumHardwareLineWidth;
192  bool ReadyForRendering;
193 
194 private:
196  void operator=(const vtkGenericOpenGLRenderWindow&) = delete;
197 };
198 
199 VTK_ABI_NAMESPACE_END
200 #endif
OpenGL rendering window.
void * GetGenericDisplayId() override
Dummy stubs for vtkWindow API.
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
void SetDisplayId(void *) override
Dummy stubs for vtkWindow API.
static vtkRenderWindow * New()
Construct an instance of vtkRenderWindow with its screen size set to 300x300, borders turned on...
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
void PushState()
no-op (for API compat with OpenGL1).
void SetWindowInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual bool IsCurrent()
Tells if this window is the current graphics context for the calling thread.
virtual void Finalize()
Finalize the rendering process.
void SetParentId(void *) override
Dummy stubs for vtkWindow API.
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FLOAT_MAX
Definition: vtkType.h:152
void SetWindowId(void *) override
Dummy stubs for vtkWindow API.
platform independent render window
a simple class to control print indentation
Definition: vtkIndent.h:28
virtual int * GetScreenSize()
Get the current size of the screen in pixels.
Definition: vtkWindow.h:94
int SupportsOpenGL() override
Does this render window support OpenGL? 0-false, 1-true.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
virtual void MakeCurrent()
Make the window current.
Definition: vtkWindow.h:235
#define VTK_SIZEHINT(...)
dynamic, self-adjusting array of unsigned char
void Frame() override
A termination method performed at the end of the rendering process to do things like swapping buffers...
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
void PopState()
no-op (for API compat with OpenGL1).
void SetParentInfo(const char *) override
Dummy stubs for vtkWindow API.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
virtual vtkTypeBool IsDirect()
Is this render window using hardware acceleration? 0-false, 1-true.