VTK  9.3.0
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
33 #ifndef vtkGenericOpenGLRenderWindow_h
34 #define vtkGenericOpenGLRenderWindow_h
35 
36 #include "vtkOpenGLRenderWindow.h"
37 #include "vtkRenderingOpenGL2Module.h" // For export macro
38 
39 VTK_ABI_NAMESPACE_BEGIN
40 class VTKRENDERINGOPENGL2_EXPORT vtkGenericOpenGLRenderWindow : public vtkOpenGLRenderWindow
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 
47 protected:
50 
51 public:
53  void Finalize() override;
54 
57  void Frame() override;
58 
61  void MakeCurrent() override;
62 
66  bool IsCurrent() override;
67 
71  int SupportsOpenGL() override;
72 
76  vtkTypeBool IsDirect() override;
77 
78  // {@
80  void SetFrontLeftBuffer(unsigned int);
81  void SetFrontRightBuffer(unsigned int);
82  void SetBackLeftBuffer(unsigned int);
83  void SetBackRightBuffer(unsigned int);
84  // }@
85 
87 
89  void PushState() {}
91  void PopState() {}
92 
93  // {@
95  void SetWindowId(void*) override;
96  void* GetGenericWindowId() override;
97  void SetDisplayId(void*) override;
98  void SetParentId(void*) override;
99  void* GetGenericDisplayId() override;
100  void* GetGenericParentId() override;
101  void* GetGenericContext() override;
102  void* GetGenericDrawable() override;
103  void SetWindowInfo(const char*) override;
104  void SetParentInfo(const char*) override;
105  int* GetScreenSize() VTK_SIZEHINT(2) override;
106  void HideCursor() override;
107  void ShowCursor() override;
108  void SetFullScreen(vtkTypeBool) override;
109  void WindowRemap() override;
110  vtkTypeBool GetEventPending() override;
111  void SetNextWindowId(void*) override;
112  void SetNextWindowInfo(const char*) override;
113  void CreateAWindow() override;
114  void DestroyWindow() override;
115  // }@
116 
118 
122  void SetIsDirect(vtkTypeBool newValue);
123  void SetSupportsOpenGL(int newValue);
124  void SetIsCurrent(bool newValue);
126 
134  void Render() override;
135 
139  float GetMaximumHardwareLineWidth() override;
140 
142 
146  vtkSetClampMacro(ForceMaximumHardwareLineWidth, float, 0, VTK_FLOAT_MAX);
147  vtkGetMacro(ForceMaximumHardwareLineWidth, float);
149 
151 
156  vtkSetMacro(ReadyForRendering, bool);
157  vtkGetMacro(ReadyForRendering, bool);
158 
163  vtkSetVector2Macro(ScreenSize, int);
164 
168  void SetCurrentCursor(int cShape) override;
169 
170  // since we are using an external context it must
171  // specify if the window is mapped or not.
172  vtkSetMacro(Mapped, vtkTypeBool);
173 
177  void OpenGLInit() override;
178 
179 protected:
185  int ReadPixels(
186  const vtkRecti& rect, int front, int glFormat, int glType, void* data, int right) override;
187 
188  int SetPixelData(
189  int x1, int y1, int x2, int y2, unsigned char* data, int front, int right) override;
190  int SetPixelData(
191  int x1, int y1, int x2, int y2, vtkUnsignedCharArray* data, int front, int right) override;
192  int SetRGBACharPixelData(
193  int x1, int y1, int x2, int y2, unsigned char* data, int front, int blend, int right) override;
194  int SetRGBACharPixelData(int x, int y, int x2, int y2, vtkUnsignedCharArray* data, int front,
195  int blend = 0, int right = 0) override;
196 
197  int DirectStatus;
198  int SupportsOpenGLStatus;
199  bool CurrentStatus;
200  float ForceMaximumHardwareLineWidth;
201  bool ReadyForRendering;
202 
203 private:
205  void operator=(const vtkGenericOpenGLRenderWindow&) = delete;
206 };
207 
208 VTK_ABI_NAMESPACE_END
209 #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:38
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(...)