VTK  9.3.20240328
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
113 #ifndef vtkGenericOpenGLRenderWindow_h
114 #define vtkGenericOpenGLRenderWindow_h
115 
116 #include "vtkOpenGLRenderWindow.h"
117 #include "vtkRenderingOpenGL2Module.h" // For export macro
118 
119 VTK_ABI_NAMESPACE_BEGIN
120 class VTKRENDERINGOPENGL2_EXPORT vtkGenericOpenGLRenderWindow : public vtkOpenGLRenderWindow
121 {
122 public:
125  void PrintSelf(ostream& os, vtkIndent indent) override;
126 
127 protected:
130 
131 public:
133  void Finalize() override;
134 
137  void Frame() override;
138 
141  void MakeCurrent() override;
142 
146  bool IsCurrent() override;
147 
151  int SupportsOpenGL() override;
152 
156  vtkTypeBool IsDirect() override;
157 
158  // {@
160  void SetFrontLeftBuffer(unsigned int);
161  void SetFrontRightBuffer(unsigned int);
162  void SetBackLeftBuffer(unsigned int);
163  void SetBackRightBuffer(unsigned int);
164  // }@
165 
167 
169  void PushState() {}
171  void PopState() {}
172 
173  // {@
175  void SetWindowId(void*) override;
176  void* GetGenericWindowId() override;
177  void SetDisplayId(void*) override;
178  void SetParentId(void*) override;
179  void* GetGenericDisplayId() override;
180  void* GetGenericParentId() override;
181  void* GetGenericContext() override;
182  void* GetGenericDrawable() override;
183  void SetWindowInfo(const char*) override;
184  void SetParentInfo(const char*) override;
185  int* GetScreenSize() VTK_SIZEHINT(2) override;
186  void HideCursor() override;
187  void ShowCursor() override;
188  void SetFullScreen(vtkTypeBool) override;
189  void WindowRemap() override;
190  vtkTypeBool GetEventPending() override;
191  void SetNextWindowId(void*) override;
192  void SetNextWindowInfo(const char*) override;
193  void CreateAWindow() override;
194  void DestroyWindow() override;
195  // }@
196 
198 
202  void SetIsDirect(vtkTypeBool newValue);
203  void SetSupportsOpenGL(int newValue);
204  void SetIsCurrent(bool newValue);
206 
214  void Render() override;
215 
219  float GetMaximumHardwareLineWidth() override;
220 
222 
226  vtkSetClampMacro(ForceMaximumHardwareLineWidth, float, 0, VTK_FLOAT_MAX);
227  vtkGetMacro(ForceMaximumHardwareLineWidth, float);
229 
231 
236  vtkSetMacro(ReadyForRendering, bool);
237  vtkGetMacro(ReadyForRendering, bool);
238 
243  vtkSetVector2Macro(ScreenSize, int);
244 
248  void SetCurrentCursor(int cShape) override;
249 
250  // since we are using an external context it must
251  // specify if the window is mapped or not.
252  vtkSetMacro(Mapped, vtkTypeBool);
253 
257  void OpenGLInit() override;
258 
259 protected:
265  int ReadPixels(
266  const vtkRecti& rect, int front, int glFormat, int glType, void* data, int right) override;
267 
268  int SetPixelData(
269  int x1, int y1, int x2, int y2, unsigned char* data, int front, int right) override;
270  int SetPixelData(
271  int x1, int y1, int x2, int y2, vtkUnsignedCharArray* data, int front, int right) override;
272  int SetRGBACharPixelData(
273  int x1, int y1, int x2, int y2, unsigned char* data, int front, int blend, int right) override;
274  int SetRGBACharPixelData(int x, int y, int x2, int y2, vtkUnsignedCharArray* data, int front,
275  int blend = 0, int right = 0) override;
276 
277  int DirectStatus;
278  int SupportsOpenGLStatus;
279  bool CurrentStatus;
280  float ForceMaximumHardwareLineWidth;
281  bool ReadyForRendering;
282 
283 private:
285  void operator=(const vtkGenericOpenGLRenderWindow&) = delete;
286 };
287 
288 VTK_ABI_NAMESPACE_END
289 #endif
platform independent render window
void Finalize() override
Cleans up graphics resources allocated in the context for this VTK scene.
void * GetGenericDisplayId() override
Dummy stubs for vtkWindow API.
void SetWindowId(void *) override
does nothing
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
int * GetScreenSize() override
Get the current size of the screen in pixels.
~vtkGenericOpenGLRenderWindow() override
vtkTypeBool IsDirect() override
Returns if the context is direct.
void SetParentInfo(const char *) override
Dummy stubs for vtkWindow API.
void SetDisplayId(void *) override
Dummy stubs for vtkWindow API.
void Frame() override
flush the pending drawing operations Class user may to watch for WindowFrameEvent and act on it
void SetParentId(void *) override
Dummy stubs for vtkWindow API.
void SetWindowInfo(const char *) override
Dummy stubs for vtkWindow API.
void SetBackRightBuffer(unsigned int)
void MakeCurrent() override
Makes the context current.
int SupportsOpenGL() override
Returns if OpenGL is supported.
void PopState()
no-op (for API compat with OpenGL1).
void SetFrontRightBuffer(unsigned int)
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
void SetOwnContext(vtkTypeBool)
void SetFrontLeftBuffer(unsigned int)
set the drawing buffers to use
void SetBackLeftBuffer(unsigned int)
void PushState()
no-op (for API compat with OpenGL1).
bool IsCurrent() override
Returns if the context is current.
void * GetGenericWindowId() override
Dummy stubs for vtkWindow API.
static vtkGenericOpenGLRenderWindow * New()
a simple class to control print indentation
Definition: vtkIndent.h:108
OpenGL rendering window.
dynamic, self-adjusting array of unsigned char
@ data
Definition: vtkX3D.h:315
int vtkTypeBool
Definition: vtkABI.h:64
#define VTK_FLOAT_MAX
Definition: vtkType.h:152
#define VTK_SIZEHINT(...)