VTK  9.2.20230326
vtkDataTransferHelper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkDataTransferHelper.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 =========================================================================*/
31 #ifndef vtkDataTransferHelper_h
32 #define vtkDataTransferHelper_h
33 
34 #include "vtkObject.h"
35 #include "vtkRenderingOpenGL2Module.h" // For export macro
36 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
37 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
38 
39 VTK_ABI_NAMESPACE_BEGIN
40 class vtkDataArray;
42 class vtkTextureObject;
43 class vtkRenderWindow;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkDataTransferHelper : public vtkObject
46 {
47 public:
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
53 
60  void SetContext(vtkRenderWindow* context);
63 
65 
75  vtkSetVector6Macro(CPUExtent, int);
76  vtkGetVector6Macro(CPUExtent, int);
78 
80 
87  vtkSetVector6Macro(GPUExtent, int);
88  vtkGetVector6Macro(GPUExtent, int);
90 
92 
99  vtkSetVector6Macro(TextureExtent, int);
100  vtkGetVector6Macro(TextureExtent, int);
102 
109 
114 
119 
124 
126 
139  vtkSetMacro(MinTextureDimension, int);
140  vtkGetMacro(MinTextureDimension, int);
142 
144 
147  vtkGetObjectMacro(Array, vtkDataArray);
148  void SetArray(vtkDataArray* array);
150 
152 
155  vtkGetObjectMacro(Texture, vtkTextureObject);
156  void SetTexture(vtkTextureObject* texture);
158 
184  bool Upload(int components = 0, int* componentList = nullptr);
185 
212  bool Download();
213 
215 
223 
226 
230  static bool IsSupported(vtkRenderWindow* renWin);
231 
232 protected:
235 
236  int CPUExtent[6];
237  int GPUExtent[6];
238  int TextureExtent[6];
239 
245 
247 
249 
250  // We try to reuse the PBO if possible.
252 
253 private:
255  void operator=(const vtkDataTransferHelper&) = delete;
256 };
257 
258 VTK_ABI_NAMESPACE_END
259 #endif
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:166
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:120
abstract base class for most VTK objects
Definition: vtkObject.h:83
abstracts an OpenGL pixel buffer object.
create a window for renderers to draw into
abstracts an OpenGL texture object.
@ value
Definition: vtkX3D.h:232
@ extent
Definition: vtkX3D.h:357