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 =========================================================================*/
30 #ifndef vtkDataTransferHelper_h
31 #define vtkDataTransferHelper_h
32 
33 #include "vtkRenderingOpenGL2Module.h" // For export macro
34 #include "vtkObject.h"
35 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
36 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
37 
38 class vtkDataArray;
40 class vtkTextureObject;
41 class vtkRenderWindow;
42 
43 class VTKRENDERINGOPENGL2_EXPORT vtkDataTransferHelper : public vtkObject
44 {
45 public:
46  static vtkDataTransferHelper* New();
48  void PrintSelf(ostream& os, vtkIndent indent);
49 
51 
55  void SetContext(vtkRenderWindow* context);
56  vtkRenderWindow* GetContext();
58 
60 
67  vtkSetVector6Macro(CPUExtent, int);
68  vtkGetVector6Macro(CPUExtent, int);
70 
72 
77  vtkSetVector6Macro(GPUExtent, int);
78  vtkGetVector6Macro(GPUExtent, int);
80 
82 
86  vtkSetVector6Macro(TextureExtent, int);
87  vtkGetVector6Macro(TextureExtent, int);
89 
92  bool GetExtentIsValid(int *extent);
93 
95  bool GetCPUExtentIsValid();
96 
98  bool GetGPUExtentIsValid();
99 
101  bool GetTextureExtentIsValid();
102 
104 
114  vtkSetMacro(MinTextureDimension,int);
115  vtkGetMacro(MinTextureDimension,int);
117 
119 
120  vtkGetObjectMacro(Array, vtkDataArray);
121  void SetArray(vtkDataArray* array);
123 
125 
126  vtkGetObjectMacro(Texture, vtkTextureObject);
127  void SetTexture(vtkTextureObject* texture);
129 
131 
153  bool Upload(int components=0,
154  int *componentList=NULL);
156 
179  bool Download();
180 
182 
185  bool DownloadAsync1();
186  bool DownloadAsync2();
188 
189  bool GetShaderSupportsTextureInt();
190  void SetShaderSupportsTextureInt(bool value);
191 
193 
194  static bool IsSupported(vtkRenderWindow* renWin);
195 //BTX
196 protected:
200 
201  int CPUExtent[6];
202  int GPUExtent[6];
203  int TextureExtent[6];
204 
206  vtkTextureObject* Texture;
207  vtkDataArray* Array;
208  bool ShaderSupportsTextureInt;
209  int MinTextureDimension;
210 
211  vtkSmartPointer<vtkPixelBufferObject> AsyncDownloadPBO;
212 
213  vtkPixelBufferObject* GetPBO();
214 
215  // We try to reuse the PBO if possible.
217 private:
218  vtkDataTransferHelper(const vtkDataTransferHelper&); // Not implemented.
219  void operator=(const vtkDataTransferHelper&); // Not implemented.
220 //ETX
221 };
222 
223 #endif
abstract base class for most VTK objects
Definition: vtkObject.h:61
virtual void PrintSelf(ostream &os, vtkIndent indent)
a simple class to control print indentation
Definition: vtkIndent.h:38
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()
is a helper class that aids in transferring data between CPU memory and GPU memory.