VTK  9.0.20210508
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 class vtkDataArray;
41 class vtkTextureObject;
42 class vtkRenderWindow;
43 
44 class VTKRENDERINGOPENGL2_EXPORT vtkDataTransferHelper : public vtkObject
45 {
46 public:
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
59  void SetContext(vtkRenderWindow* context);
62 
64 
74  vtkSetVector6Macro(CPUExtent, int);
75  vtkGetVector6Macro(CPUExtent, int);
77 
79 
86  vtkSetVector6Macro(GPUExtent, int);
87  vtkGetVector6Macro(GPUExtent, int);
89 
91 
98  vtkSetVector6Macro(TextureExtent, int);
99  vtkGetVector6Macro(TextureExtent, int);
101 
108 
113 
118 
123 
125 
138  vtkSetMacro(MinTextureDimension, int);
139  vtkGetMacro(MinTextureDimension, int);
141 
143 
146  vtkGetObjectMacro(Array, vtkDataArray);
147  void SetArray(vtkDataArray* array);
149 
151 
154  vtkGetObjectMacro(Texture, vtkTextureObject);
155  void SetTexture(vtkTextureObject* texture);
157 
183  bool Upload(int components = 0, int* componentList = nullptr);
184 
211  bool Download();
212 
214 
222 
225 
229  static bool IsSupported(vtkRenderWindow* renWin);
230 
231 protected:
234 
235  int CPUExtent[6];
236  int GPUExtent[6];
237  int TextureExtent[6];
238 
244 
246 
248 
249  // We try to reuse the PBO if possible.
251 
252 private:
254  void operator=(const vtkDataTransferHelper&) = delete;
255 };
256 
257 #endif
vtkDataTransferHelper::SetTexture
void SetTexture(vtkTextureObject *texture)
Get/Set the GPU data buffer.
vtkDataTransferHelper::ShaderSupportsTextureInt
bool ShaderSupportsTextureInt
Definition: vtkDataTransferHelper.h:242
vtkDataTransferHelper::SetShaderSupportsTextureInt
void SetShaderSupportsTextureInt(bool value)
vtkDataTransferHelper
is a helper class that aids in transferring data between CPU memory and GPU memory.
Definition: vtkDataTransferHelper.h:45
vtkDataTransferHelper::SetContext
void SetContext(vtkRenderWindow *context)
Get/Set the context.
vtkX3D::value
@ value
Definition: vtkX3D.h:226
vtkDataTransferHelper::Download
bool Download()
old comment: Download Extent from GPU data buffer to CPU.
vtkSmartPointer< vtkPixelBufferObject >
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:63
vtkDataTransferHelper::Context
vtkWeakPointer< vtkRenderWindow > Context
Definition: vtkDataTransferHelper.h:239
vtkDataTransferHelper::GetExtentIsValid
bool GetExtentIsValid(int *extent)
Tells if the given extent (6 int) is valid.
vtkDataArray
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:50
vtkDataTransferHelper::GetCPUExtentIsValid
bool GetCPUExtentIsValid()
Tells if CPUExtent is valid.
vtkDataTransferHelper::~vtkDataTransferHelper
~vtkDataTransferHelper() override
vtkDataTransferHelper::DownloadAsync1
bool DownloadAsync1()
Splits the download in two operations.
vtkDataTransferHelper::IsSupported
static bool IsSupported(vtkRenderWindow *renWin)
Returns if the context supports the required extensions.
vtkDataTransferHelper::SetArray
void SetArray(vtkDataArray *array)
Get/Set the CPU data buffer.
vtkDataTransferHelper::GetGPUExtentIsValid
bool GetGPUExtentIsValid()
Tells if GPUExtent is valid.
vtkDataTransferHelper::MinTextureDimension
int MinTextureDimension
Definition: vtkDataTransferHelper.h:243
vtkDataTransferHelper::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkDataTransferHelper::GetTextureExtentIsValid
bool GetTextureExtentIsValid()
Tells if TextureExtent is valid.
vtkDataTransferHelper::GetShaderSupportsTextureInt
bool GetShaderSupportsTextureInt()
vtkDataTransferHelper::GetPBO
vtkPixelBufferObject * GetPBO()
vtkDataTransferHelper::New
static vtkDataTransferHelper * New()
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:34
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:41
vtkDataTransferHelper::PBO
vtkSmartPointer< vtkPixelBufferObject > PBO
Definition: vtkDataTransferHelper.h:250
vtkSmartPointer.h
vtkWeakPointer.h
vtkObject.h
vtkDataTransferHelper::AsyncDownloadPBO
vtkSmartPointer< vtkPixelBufferObject > AsyncDownloadPBO
Definition: vtkDataTransferHelper.h:245
vtkDataTransferHelper::vtkDataTransferHelper
vtkDataTransferHelper()
vtkDataTransferHelper::Upload
bool Upload(int components=0, int *componentList=nullptr)
Old comment.
vtkDataTransferHelper::DownloadAsync2
bool DownloadAsync2()
Splits the download in two operations.
vtkX3D::extent
@ extent
Definition: vtkX3D.h:351
vtkRenderWindow
create a window for renderers to draw into
Definition: vtkRenderWindow.h:96
vtkDataTransferHelper::Texture
vtkTextureObject * Texture
Definition: vtkDataTransferHelper.h:240
vtkDataTransferHelper::Array
vtkDataArray * Array
Definition: vtkDataTransferHelper.h:241
vtkPixelBufferObject
abstracts an OpenGL pixel buffer object.
Definition: vtkPixelBufferObject.h:44
vtkWeakPointer< vtkRenderWindow >
vtkDataTransferHelper::GetContext
vtkRenderWindow * GetContext()
Get/Set the context.