VTK
/Users/kitware/Dashboards/MyTests/VTK_BLD_Release_docs/Utilities/Doxygen/dox/Rendering/OpenGL/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 "vtkRenderingOpenGLModule.h" // For export macro
00034 #include "vtkObject.h"
00035 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
00036 #include "vtkSmartPointer.h" // needed for vtkSmartPointer.
00037 
00038 class vtkDataArray;
00039 class vtkPixelBufferObject;
00040 class vtkTextureObject;
00041 class vtkOpenGLExtensionManager;
00042 class vtkRenderWindow;
00043 
00044 class VTKRENDERINGOPENGL_EXPORT vtkDataTransferHelper : public vtkObject
00045 {
00046 public:
00047   static vtkDataTransferHelper* New();
00048   vtkTypeMacro(vtkDataTransferHelper, vtkObject);
00049   void PrintSelf(ostream& os, vtkIndent indent);
00050 
00052 
00056   void SetContext(vtkRenderWindow* context);
00057   vtkRenderWindow* GetContext();
00059 
00061 
00068   vtkSetVector6Macro(CPUExtent, int);
00069   vtkGetVector6Macro(CPUExtent, int);
00071 
00073 
00078   vtkSetVector6Macro(GPUExtent, int);
00079   vtkGetVector6Macro(GPUExtent, int);
00081 
00083 
00087   vtkSetVector6Macro(TextureExtent, int);
00088   vtkGetVector6Macro(TextureExtent, int);
00090 
00093   bool GetExtentIsValid(int *extent);
00094 
00096   bool GetCPUExtentIsValid();
00097 
00099   bool GetGPUExtentIsValid();
00100 
00102   bool GetTextureExtentIsValid();
00103 
00105 
00115   vtkSetMacro(MinTextureDimension,int);
00116   vtkGetMacro(MinTextureDimension,int);
00118 
00120 
00121   vtkGetObjectMacro(Array, vtkDataArray);
00122   void SetArray(vtkDataArray* array);
00124 
00126 
00127   vtkGetObjectMacro(Texture, vtkTextureObject);
00128   void SetTexture(vtkTextureObject* texture);
00130 
00132 
00154   bool Upload(int components=0,
00155               int *componentList=NULL);
00157 
00180   bool Download();
00181 
00183 
00186   bool DownloadAsync1();
00187   bool DownloadAsync2();
00189 
00190   bool GetShaderSupportsTextureInt();
00191   void SetShaderSupportsTextureInt(bool value);
00192 
00194 
00195   static bool IsSupported(vtkRenderWindow* renWin);
00196 //BTX
00197 protected:
00198   vtkDataTransferHelper();
00199   ~vtkDataTransferHelper();
00201 
00203   bool LoadRequiredExtensions(vtkOpenGLExtensionManager*);
00204 
00205   int CPUExtent[6];
00206   int GPUExtent[6];
00207   int TextureExtent[6];
00208 
00209   vtkWeakPointer<vtkRenderWindow> Context;
00210   vtkTextureObject* Texture;
00211   vtkDataArray* Array;
00212   bool ShaderSupportsTextureInt;
00213   int MinTextureDimension;
00214 
00215   vtkSmartPointer<vtkPixelBufferObject> AsyncDownloadPBO;
00216 
00217   vtkPixelBufferObject* GetPBO();
00218 
00219   // We try to reuse the PBO if possible.
00220   vtkSmartPointer<vtkPixelBufferObject> PBO;
00221 private:
00222   vtkDataTransferHelper(const vtkDataTransferHelper&); // Not implemented.
00223   void operator=(const vtkDataTransferHelper&); // Not implemented.
00224 //ETX
00225 };
00226 
00227 #endif