VTK
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 =========================================================================*/
33 #ifndef vtkGenericOpenGLRenderWindow_h
34 #define vtkGenericOpenGLRenderWindow_h
35 
36 #include "vtkRenderingOpenGL2Module.h" // For export macro
37 #include "vtkOpenGLRenderWindow.h"
38 
39 class VTKRENDERINGOPENGL2_EXPORT vtkGenericOpenGLRenderWindow :
41 {
42 public:
45  void PrintSelf(ostream& os, vtkIndent indent) override;
46 protected:
48  ~vtkGenericOpenGLRenderWindow() override;
49 
50 public:
51 
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  int IsDirect() override;
77 
78  // {@
80  void SetFrontBuffer(unsigned int);
81  void SetFrontLeftBuffer(unsigned int);
82  void SetFrontRightBuffer(unsigned int);
83  void SetBackBuffer(unsigned int);
84  void SetBackLeftBuffer(unsigned int);
85  void SetBackRightBuffer(unsigned int);
86  // }@
87 
88  void SetDefaultFrameBufferId(unsigned int);
89  void SetOwnContext(int);
90 
92  void PushState() {}
94  void PopState() {}
95 
96  // {@
98  void SetWindowId(void*) override;
99  void* GetGenericWindowId() override;
100  void SetDisplayId(void*) override;
101  void SetParentId(void*) override;
102  void* GetGenericDisplayId() override;
103  void* GetGenericParentId() override;
104  void* GetGenericContext() override;
105  void* GetGenericDrawable() override;
106  void SetWindowInfo(const char*) override;
107  void SetParentInfo(const char*) override;
108  int* GetScreenSize() VTK_SIZEHINT(2) override;
109  void HideCursor() override;
110  void ShowCursor() override;
111  void SetFullScreen(vtkTypeBool) override;
112  void WindowRemap() override;
113  int GetEventPending() override;
114  void SetNextWindowId(void*) override;
115  void SetNextWindowInfo(const char*) override;
116  void CreateAWindow() override;
117  void DestroyWindow() override;
118  // }@
119 
121 
125  void SetIsDirect(int newValue);
126  void SetSupportsOpenGL(int newValue);
127  void SetIsCurrent(bool newValue);
129 
137  void Render() override;
138 
142  float GetMaximumHardwareLineWidth() override;
143 
145 
149  vtkSetClampMacro(ForceMaximumHardwareLineWidth, float, 0, VTK_FLOAT_MAX);
150  vtkGetMacro(ForceMaximumHardwareLineWidth, float);
152 
154 
159  vtkSetMacro(ReadyForRendering, bool);
160  vtkGetMacro(ReadyForRendering, bool);
161 
165  vtkSetVector2Macro(ScreenSize,int);
166 
170  void SetCurrentCursor(int cShape) override;
171 
172  // since we are using an external context it must
173  // specify if the window is mapped or not.
174  vtkSetMacro(Mapped, vtkTypeBool);
175 
179  bool IsDrawable() override { return this->ReadyForRendering; }
180 
181 protected:
187  int ReadPixels(
188  const vtkRecti& rect, int front, int glFormat, int glType, void* data, int right) override;
189 
195  int ScreenSize[2];
196 
197 private:
199  void operator=(const vtkGenericOpenGLRenderWindow&) = delete;
200 };
201 
202 #endif
OpenGL rendering window.
virtual void Finalize()=0
Finalize the rendering process.
virtual void WindowRemap()=0
Remap the rendering window.
virtual void HideCursor()=0
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.
static vtkRenderWindow * New()
Construct an instance of vtkRenderWindow with its screen size set to 300x300, borders turned on...
virtual int * GetScreenSize()=0
Get the current size of the screen in pixels.
void PushState()
no-op (for API compat with OpenGL1).
void * GetGenericContext() override=0
Dummy stubs for vtkWindow API.
virtual void SetCurrentCursor(int)
Change the shape of the cursor.
void SetWindowInfo(const char *) override=0
Dummy stubs for vtkWindow API.
void * GetGenericParentId() override=0
Dummy stubs for vtkWindow API.
virtual int GetEventPending()=0
Check to see if a mouse button has been pressed.
bool CurrentStatus
Set this to true to indicate that the context is now ready.
int vtkTypeBool
Definition: vtkABI.h:69
void * GetGenericDisplayId() override=0
Dummy stubs for vtkWindow API.
virtual int IsDirect()
Is this render window using hardware acceleration? 0-false, 1-true.
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 bool IsCurrent()=0
Tells if this window is the current graphics context for the calling thread.
bool IsDrawable() override
Overridden to simply call GetReadyForRendering
#define VTK_FLOAT_MAX
Definition: vtkType.h:169
void SetWindowId(void *) override=0
Dummy stubs for vtkWindow API.
platform independent render window
void SetDisplayId(void *) override=0
Dummy stubs for vtkWindow API.
a simple class to control print indentation
Definition: vtkIndent.h:39
virtual void DestroyWindow()=0
Destroy a not-off-screen window.
int SupportsOpenGL() override
Does this render window support OpenGL? 0-false, 1-true.
void SetParentInfo(const char *) override=0
Dummy stubs for vtkWindow API.
virtual void SetNextWindowId(void *)=0
Dummy stubs for vtkWindow API.
#define VTK_SIZEHINT(...)
virtual void Frame()=0
A termination method performed at the end of the rendering process to do things like swapping buffers...
void SetParentId(void *) override=0
Dummy stubs for vtkWindow API.
virtual void SetFullScreen(vtkTypeBool)=0
Turn on/off rendering full screen window size.
void * GetGenericDrawable() override=0
Dummy stubs for vtkWindow API.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual void SetNextWindowInfo(const char *)=0
Dummy stubs for vtkWindow API.
virtual float GetMaximumHardwareLineWidth()
Return the largest line width supported by the hardware.
void PopState()
no-op (for API compat with OpenGL1).
void * GetGenericWindowId() override=0
Dummy stubs for vtkWindow API.
virtual void CreateAWindow()=0
Create a not-off-screen window.
virtual int ReadPixels(const vtkRecti &rect, int front, int glFormat, int glType, void *data, int right=0)
void MakeCurrent() override=0
Attempt to make this window the current graphics context for the calling thread.
virtual void ShowCursor()=0
Hide or Show the mouse cursor, it is nice to be able to hide the default cursor if you want VTK to di...
bool ReadyForRendering
Set this to true to indicate that the context is now ready.
int DirectStatus
Set this to true to indicate that the context is now ready.