VTK  9.3.20240329
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:
38  void PrintSelf(ostream& os, vtkIndent indent) override;
39 
41 
48  void SetContext(vtkRenderWindow* context);
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 
97 
102 
107 
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 
211 
214 
218  static bool IsSupported(vtkRenderWindow* renWin);
219 
220 protected:
223 
224  int CPUExtent[6];
225  int GPUExtent[6];
226  int TextureExtent[6];
227 
233 
235 
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 superclass for arrays of numeric data
Definition: vtkDataArray.h:155
is a helper class that aids in transferring data between CPU memory and GPU memory.
vtkWeakPointer< vtkRenderWindow > Context
bool GetTextureExtentIsValid()
Tells if TextureExtent is valid.
bool GetGPUExtentIsValid()
Tells if GPUExtent is valid.
vtkTextureObject * Texture
void SetContext(vtkRenderWindow *context)
Get/Set the context.
bool Upload(int components=0, int *componentList=nullptr)
Old comment.
vtkSmartPointer< vtkPixelBufferObject > PBO
bool Download()
old comment: Download Extent from GPU data buffer to CPU.
vtkPixelBufferObject * GetPBO()
vtkSmartPointer< vtkPixelBufferObject > AsyncDownloadPBO
bool GetExtentIsValid(int *extent)
Tells if the given extent (6 int) is valid.
bool GetCPUExtentIsValid()
Tells if CPUExtent is valid.
bool DownloadAsync1()
Splits the download in two operations.
bool GetShaderSupportsTextureInt()
static vtkDataTransferHelper * New()
static bool IsSupported(vtkRenderWindow *renWin)
Returns if the context supports the required extensions.
~vtkDataTransferHelper() override
bool DownloadAsync2()
Splits the download in two operations.
void SetTexture(vtkTextureObject *texture)
Get/Set the GPU data buffer.
void SetArray(vtkDataArray *array)
Get/Set the CPU data buffer.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkRenderWindow * GetContext()
Get/Set the context.
void SetShaderSupportsTextureInt(bool value)
a simple class to control print indentation
Definition: vtkIndent.h:108
abstract base class for most VTK objects
Definition: vtkObject.h:162
abstracts an OpenGL pixel buffer object.
create a window for renderers to draw into
abstracts an OpenGL texture object.
@ value
Definition: vtkX3D.h:220
@ extent
Definition: vtkX3D.h:345