VTK
dox/Rendering/vtkDataTransferHelper.h
Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    vtkDataTransferHelper.h
00005 
00006   Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
00007   All rights reserved.
00008   See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
00009 
00010      This software is distributed WITHOUT ANY WARRANTY; without even
00011      the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
00012      PURPOSE.  See the above copyright notice for more information.
00013 
00014 =========================================================================*/
00030 #ifndef __vtkDataTransferHelper_h
00031 #define __vtkDataTransferHelper_h
00032 
00033 #include "vtkObject.h"
00034 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
00035 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
00036 
00037 class vtkDataArray;
00038 class vtkPixelBufferObject;
00039 class vtkTextureObject;
00040 class vtkOpenGLExtensionManager;
00041 class vtkRenderWindow;
00042 
00043 class VTK_RENDERING_EXPORT vtkDataTransferHelper : public vtkObject
00044 {
00045 public:
00046   static vtkDataTransferHelper* New();
00047   vtkTypeMacro(vtkDataTransferHelper, vtkObject);
00048   void PrintSelf(ostream& os, vtkIndent indent);
00049 
00051 
00055   void SetContext(vtkRenderWindow* context);
00056   vtkRenderWindow* GetContext();
00058 
00060 
00067   vtkSetVector6Macro(CPUExtent, int);
00068   vtkGetVector6Macro(CPUExtent, int);
00070 
00072 
00077   vtkSetVector6Macro(GPUExtent, int);
00078   vtkGetVector6Macro(GPUExtent, int);
00080 
00082 
00086   vtkSetVector6Macro(TextureExtent, int);
00087   vtkGetVector6Macro(TextureExtent, int);
00089 
00092   bool GetExtentIsValid(int *extent);
00093 
00095   bool GetCPUExtentIsValid();
00096 
00098   bool GetGPUExtentIsValid();
00099 
00101   bool GetTextureExtentIsValid();
00102 
00104 
00114   vtkSetMacro(MinTextureDimension,int);
00115   vtkGetMacro(MinTextureDimension,int);
00117 
00119 
00120   vtkGetObjectMacro(Array, vtkDataArray);
00121   void SetArray(vtkDataArray* array);
00123 
00125 
00126   vtkGetObjectMacro(Texture, vtkTextureObject);
00127   void SetTexture(vtkTextureObject* texture);
00129 
00131 
00156   bool Upload(int components=0,
00157               int *componentList=NULL);
00159 
00185   bool Download();
00186 
00188 
00191   bool DownloadAsync1();
00192   bool DownloadAsync2();
00194   
00195   bool GetShaderSupportsTextureInt();
00196   void SetShaderSupportsTextureInt(bool value);
00197 
00199 
00200   static bool IsSupported(vtkRenderWindow* renWin);
00201 //BTX
00202 protected:
00203   vtkDataTransferHelper();
00204   ~vtkDataTransferHelper();
00206 
00208   bool LoadRequiredExtensions(vtkOpenGLExtensionManager*);
00209 
00210   int CPUExtent[6];
00211   int GPUExtent[6];
00212   int TextureExtent[6];
00213 
00214   vtkWeakPointer<vtkRenderWindow> Context;
00215   vtkTextureObject* Texture;
00216   vtkDataArray* Array;
00217   bool ShaderSupportsTextureInt;
00218   int MinTextureDimension;
00219 
00220   vtkSmartPointer<vtkPixelBufferObject> AsyncDownloadPBO;
00221 
00222   vtkPixelBufferObject* GetPBO();
00223 
00224   // We try to reuse the PBO if possible.
00225   vtkSmartPointer<vtkPixelBufferObject> PBO;
00226 private:
00227   vtkDataTransferHelper(const vtkDataTransferHelper&); // Not implemented.
00228   void operator=(const vtkDataTransferHelper&); // Not implemented.
00229 //ETX
00230 };
00231 
00232 #endif