VTK  9.0.1
vtkGenericOpenGLRenderWindow.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkRenderWindow.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
27 #ifndef vtkGenericOpenGLRenderWindow_h
28 #define vtkGenericOpenGLRenderWindow_h
29 
30 #include "vtkOpenGLRenderWindow.h"
31 #include "vtkRenderingOpenGL2Module.h" // For export macro
32 
33 class VTKRENDERINGOPENGL2_EXPORT vtkGenericOpenGLRenderWindow : public vtkOpenGLRenderWindow
34 {
35 public:
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
40 protected:
42  ~vtkGenericOpenGLRenderWindow() override;
43 
44 public:
46  void Finalize() override;
47 
50  void Frame() override;
51 
54  void MakeCurrent() override;
55 
59  bool IsCurrent() override;
60 
64  int SupportsOpenGL() override;
65 
69  vtkTypeBool IsDirect() override;
70 
71  // {@
73  void SetFrontLeftBuffer(unsigned int);
74  void SetFrontRightBuffer(unsigned int);
75  void SetBackLeftBuffer(unsigned int);
76  void SetBackRightBuffer(unsigned int);
77  // }@
78 
79  void SetDefaultFrameBufferId(unsigned int);
80  void SetOwnContext(int);
81 
83  void PushState() {}
85  void PopState() {}
86 
87  // {@
89  void SetWindowId(void*) override;
90  void* GetGenericWindowId() override;
91  void SetDisplayId(void*) override;
92  void SetParentId(void*) override;
93  void* GetGenericDisplayId() override;
94  void* GetGenericParentId() override;
95  void* GetGenericContext() override;
96  void* GetGenericDrawable() override;
97  void SetWindowInfo(const char*) override;
98  void SetParentInfo(const char*) override;
99  int* GetScreenSize() VTK_SIZEHINT(2) override;
100  void HideCursor() override;
101  void ShowCursor() override;
102  void SetFullScreen(vtkTypeBool) override;
103  void WindowRemap() override;
104  vtkTypeBool GetEventPending() override;
105  void SetNextWindowId(void*) override;
106  void SetNextWindowInfo(const char*) override;
107  void CreateAWindow() override;
108  void DestroyWindow() override;
109  // }@
110 
112 
116  void SetIsDirect(vtkTypeBool newValue);
117  void SetSupportsOpenGL(int newValue);
118  void SetIsCurrent(bool newValue);
120 
128  void Render() override;
129 
133  float GetMaximumHardwareLineWidth() override;
134 
136 
140  vtkSetClampMacro(ForceMaximumHardwareLineWidth, float, 0, VTK_FLOAT_MAX);
141  vtkGetMacro(ForceMaximumHardwareLineWidth, float);
143 
145 
150  vtkSetMacro(ReadyForRendering, bool);
151  vtkGetMacro(ReadyForRendering, bool);
152 
157  vtkSetVector2Macro(ScreenSize, int);
158 
162  void SetCurrentCursor(int cShape) override;
163 
164  // since we are using an external context it must
165  // specify if the window is mapped or not.
166  vtkSetMacro(Mapped, vtkTypeBool);
167 
171  VTK_LEGACY(bool IsDrawable() override);
172 
173 protected:
179  int ReadPixels(
180  const vtkRecti& rect, int front, int glFormat, int glType, void* data, int right) override;
181 
182  int SetPixelData(
183  int x1, int y1, int x2, int y2, unsigned char* data, int front, int right) override;
184  int SetPixelData(
185  int x1, int y1, int x2, int y2, vtkUnsignedCharArray* data, int front, int right) override;
187  int x1, int y1, int x2, int y2, unsigned char* data, int front, int blend, int right) override;
188  int SetRGBACharPixelData(int x, int y, int x2, int y2, vtkUnsignedCharArray* data, int front,
189  int blend = 0, int right = 0) override;
190 
196 
197 private:
199  void operator=(const vtkGenericOpenGLRenderWindow&) = delete;
200 };
201 
202 #endif
OpenGL rendering window.
virtual void SetFullScreen(vtkTypeBool)
Turn on/off rendering full screen window size.
void * GetGenericDisplayId() override
Dummy stubs for vtkWindow API.
void * GetGenericContext() override
Dummy stubs for vtkWindow API.
virtual void WindowRemap()
Remap the rendering window.
void SetDisplayId(void *) override
Dummy stubs for vtkWindow API.
virtual void HideCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
void Render() override
Handle opengl specific code and calls superclass.
virtual void SetNextWindowId(void *)
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 MakeCurrent() override
Attempt to make this window the current graphics context for the calling thread.
void PushState()
no-op (for API compat with OpenGL1).
void SetWindowInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual void SetCurrentCursor(int)
Change the shape of the cursor.
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.
bool CurrentStatus
Set this to true to indicate that the context is now ready.
int vtkTypeBool
Definition: vtkABI.h:69
float ForceMaximumHardwareLineWidth
Set this to true to indicate that the context is now ready.
int SupportsOpenGLStatus
Set this to true to indicate that the context is now ready.
virtual void SetNextWindowInfo(const char *)
Dummy stubs for vtkWindow API.
#define VTK_FLOAT_MAX
Definition: vtkType.h:163
void SetWindowId(void *) override
Dummy stubs for vtkWindow API.
platform independent render window
a simple class to control print indentation
Definition: vtkIndent.h:33
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
virtual void ShowCursor()
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
virtual int * GetScreenSize()
Get the current size of the screen in pixels.
Definition: vtkWindow.h:101
int SupportsOpenGL() override
Does this render window support OpenGL? 0-false, 1-true.
void * GetGenericParentId() override
Dummy stubs for vtkWindow API.
#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...
virtual vtkTypeBool GetEventPending()
Check to see if a mouse button has been pressed.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual float GetMaximumHardwareLineWidth()
Return the largest line width supported by the hardware.
void PopState()
no-op (for API compat with OpenGL1).
int SetRGBACharPixelData(int x, int y, int x2, int y2, unsigned char *data, int front, int blend=0, int right=0) override
Set/Get the pixel data of an image, transmitted as RGBARGBA...
void SetParentInfo(const char *) override
Dummy stubs for vtkWindow API.
virtual void CreateAWindow()=0
Create a not-off-screen window.
void * GetGenericDrawable() override
Dummy stubs for vtkWindow API.
virtual int ReadPixels(const vtkRecti &rect, int front, int glFormat, int glType, void *data, int right=0)
virtual vtkTypeBool IsDirect()
Is this render window using hardware acceleration? 0-false, 1-true.
bool ReadyForRendering
Set this to true to indicate that the context is now ready.
virtual bool IsDrawable()
Test if the window has a valid drawable.
int SetPixelData(int x, int y, int x2, int y2, unsigned char *data, int front, int right) override
Set/Get the pixel data of an image, transmitted as RGBRGB...
int DirectStatus
Set this to true to indicate that the context is now ready.