VTK
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 "vtkRenderingOpenGL2Module.h" // For export macro
35 #include "vtkObject.h"
36 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
37 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
38 
39 class vtkDataArray;
41 class vtkTextureObject;
42 class vtkRenderWindow;
43 
44 class VTKRENDERINGOPENGL2_EXPORT vtkDataTransferHelper : public vtkObject
45 {
46 public:
47  static vtkDataTransferHelper* New();
49  void PrintSelf(ostream& os, vtkIndent indent) override;
50 
52 
59  void SetContext(vtkRenderWindow* context);
60  vtkRenderWindow* GetContext();
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 
107  bool GetExtentIsValid(int *extent);
108 
112  bool GetCPUExtentIsValid();
113 
117  bool GetGPUExtentIsValid();
118 
122  bool GetTextureExtentIsValid();
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 
178  bool Upload(int components=0,
179  int *componentList=nullptr);
180 
204  bool Download();
205 
207 
212  bool DownloadAsync1();
213  bool DownloadAsync2();
215 
216  bool GetShaderSupportsTextureInt();
217  void SetShaderSupportsTextureInt(bool value);
218 
222  static bool IsSupported(vtkRenderWindow* renWin);
223 
224 protected:
226  ~vtkDataTransferHelper() override;
227 
228  int CPUExtent[6];
229  int GPUExtent[6];
230  int TextureExtent[6];
231 
237 
239 
240  vtkPixelBufferObject* GetPBO();
241 
242  // We try to reuse the PBO if possible.
244 private:
246  void operator=(const vtkDataTransferHelper&) = delete;
247 
248 };
249 
250 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:59
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:39
vtkSmartPointer< vtkPixelBufferObject > PBO
abstract superclass for arrays of numeric data
Definition: vtkDataArray.h:54
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