VTK  9.7.1
vtkRenderbuffer.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
10 #ifndef vtkRenderbuffer_h
11 #define vtkRenderbuffer_h
12 
13 #include "vtkObject.h"
14 #include "vtkRenderingOpenGL2Module.h" // for export macro
15 #include "vtkWeakPointer.h" // for render context
16 
17 VTK_ABI_NAMESPACE_BEGIN
18 class vtkRenderWindow;
19 class vtkWindow;
20 
21 class VTKRENDERINGOPENGL2_EXPORT vtkRenderbuffer : public vtkObject
22 {
23 public:
24  static vtkRenderbuffer* New();
25  vtkTypeMacro(vtkRenderbuffer, vtkObject);
26  void PrintSelf(ostream& os, vtkIndent indent) override;
27 
32  static bool IsSupported(vtkRenderWindow* renWin);
33 
35 
38  vtkGetMacro(Handle, unsigned int);
40 
42 
49  void SetContext(vtkRenderWindow* win);
50  vtkRenderWindow* GetContext();
52 
57  int CreateColorAttachment(unsigned int width, unsigned int height);
58 
63  int CreateDepthAttachment(unsigned int width, unsigned int height);
64 
69  int Create(unsigned int format, unsigned int width, unsigned int height);
70  int Create(unsigned int format, unsigned int width, unsigned int height, unsigned int samples);
71 
72  void ReleaseGraphicsResources(vtkWindow* win);
73 
74  // resizes an existing renderbuffer
75  void Resize(unsigned int width, unsigned int height);
76 
78 
82  vtkGetMacro(Width, unsigned int);
83  vtkGetMacro(Height, unsigned int);
84  vtkGetMacro(Samples, unsigned int);
85  vtkGetMacro(Format, unsigned int);
87 
88 protected:
90  ~vtkRenderbuffer() override;
91 
92  bool LoadRequiredExtensions(vtkRenderWindow* renWin);
93  void Alloc();
94  void Free();
95 
97 
98  unsigned int Width;
99  unsigned int Height;
100  unsigned int Format;
101  unsigned int Samples;
102 
103 private:
104  unsigned int Handle;
106 
107  vtkRenderbuffer(const vtkRenderbuffer&) = delete;
108  void operator=(const vtkRenderbuffer&) = delete;
109 };
110 
111 VTK_ABI_NAMESPACE_END
112 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:52
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
unsigned int Format
window superclass for vtkRenderWindow
Definition: vtkWindow.h:41
a simple class to control print indentation
Definition: vtkIndent.h:28
unsigned int Samples
create a window for renderers to draw into
unsigned int Height
Storage for FBO's.
unsigned int Width
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...