VTK  9.3.1
vtkDataTransferHelper.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
19 #ifndef vtkDataTransferHelper_h
20 #define vtkDataTransferHelper_h
21 
22 #include "vtkObject.h"
23 #include "vtkRenderingOpenGL2Module.h" // For export macro
24 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
25 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
26 
27 VTK_ABI_NAMESPACE_BEGIN
28 class vtkDataArray;
30 class vtkTextureObject;
31 class vtkRenderWindow;
32 
33 class VTKRENDERINGOPENGL2_EXPORT vtkDataTransferHelper : public vtkObject
34 {
35 public:
36  static vtkDataTransferHelper* New();
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
48  void SetContext(vtkRenderWindow* context);
49  vtkRenderWindow* GetContext();
51 
53 
63  vtkSetVector6Macro(CPUExtent, int);
64  vtkGetVector6Macro(CPUExtent, int);
66 
68 
75  vtkSetVector6Macro(GPUExtent, int);
76  vtkGetVector6Macro(GPUExtent, int);
78 
80 
87  vtkSetVector6Macro(TextureExtent, int);
88  vtkGetVector6Macro(TextureExtent, int);
90 
96  bool GetExtentIsValid(int* extent);
97 
101  bool GetCPUExtentIsValid();
102 
106  bool GetGPUExtentIsValid();
107 
111  bool GetTextureExtentIsValid();
112 
114 
127  vtkSetMacro(MinTextureDimension, int);
128  vtkGetMacro(MinTextureDimension, int);
130 
132 
135  vtkGetObjectMacro(Array, vtkDataArray);
136  void SetArray(vtkDataArray* array);
138 
140 
143  vtkGetObjectMacro(Texture, vtkTextureObject);
144  void SetTexture(vtkTextureObject* texture);
146 
172  bool Upload(int components = 0, int* componentList = nullptr);
173 
200  bool Download();
201 
203 
208  bool DownloadAsync1();
209  bool DownloadAsync2();
211 
212  bool GetShaderSupportsTextureInt();
213  void SetShaderSupportsTextureInt(bool value);
214 
218  static bool IsSupported(vtkRenderWindow* renWin);
219 
220 protected:
222  ~vtkDataTransferHelper() override;
223 
224  int CPUExtent[6];
225  int GPUExtent[6];
226  int TextureExtent[6];
227 
233 
235 
236  vtkPixelBufferObject* GetPBO();
237 
238  // We try to reuse the PBO if possible.
240 
241 private:
243  void operator=(const vtkDataTransferHelper&) = delete;
244 };
245 
246 VTK_ABI_NAMESPACE_END
247 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkWeakPointer< vtkRenderWindow > Context
vtkSmartPointer< vtkPixelBufferObject > AsyncDownloadPBO
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkSmartPointer< vtkPixelBufferObject > PBO
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:44
abstracts an OpenGL pixel buffer object.
abstracts an OpenGL texture object.
create a window for renderers to draw into
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
is a helper class that aids in transferring data between CPU memory and GPU memory.
vtkTextureObject * Texture