• Main Page
  • Related Pages
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

dox/Rendering/vtkPixelBufferObject.h

Go to the documentation of this file.
00001 /*=========================================================================
00002 
00003   Program:   Visualization Toolkit
00004   Module:    $RCSfile: vtkPixelBufferObject.h,v $
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 =========================================================================*/
00029 #ifndef __vtkPixelBufferObject_h
00030 #define __vtkPixelBufferObject_h
00031 
00032 #include "vtkObject.h"
00033 #include "vtkWeakPointer.h" // needed for vtkWeakPointer.
00034 
00035 class vtkRenderWindow;
00036 class vtkOpenGLExtensionManager;
00037 
00038 class VTK_RENDERING_EXPORT vtkPixelBufferObject : public vtkObject
00039 {
00040 public:
00041   static vtkPixelBufferObject* New();
00042   vtkTypeRevisionMacro(vtkPixelBufferObject, vtkObject);
00043   void PrintSelf(ostream& os, vtkIndent indent);
00044 
00046 
00050   void SetContext(vtkRenderWindow* context);
00051   vtkRenderWindow* GetContext();
00053 
00055 
00061   bool Upload1D(int type, void* data, 
00062     unsigned int numtuples, int comps, vtkIdType increment)
00063     {
00064     unsigned int newdims[3];
00065     newdims[0] = numtuples;
00066     newdims[1] = 1;
00067     newdims[2] = 1;
00068     vtkIdType newinc[3];
00069     newinc[0] = increment;
00070     newinc[1] = 0;
00071     newinc[2] = 0;
00072     return this->Upload3D(type, data, newdims, comps, newinc,0,0);
00073     }
00075 
00077 
00082   bool Upload2D(int type, void* data,
00083     unsigned int dims[2],
00084     int comps,
00085     vtkIdType increments[2])
00086     {
00087     unsigned int newdims[3];
00088     newdims[0] = dims[0];
00089     newdims[1] = dims[1];
00090     newdims[2] = 1;
00091     vtkIdType newinc[3];
00092     newinc[0] = increments[0];
00093     newinc[1] = increments[1];
00094     newinc[2] = 0;
00095     return this->Upload3D(type, data, newdims, comps, newinc,0,0);
00096     }
00098 
00100 
00105   bool Upload3D(int type, void* data,
00106                 unsigned int dims[3], int comps,
00107                 vtkIdType increments[3],
00108                 int components,
00109                 int *componentList);
00111 
00113 
00116   vtkGetMacro(Type, int);
00118 
00120 
00122   vtkGetMacro(Size, unsigned int);
00124 
00126 
00127   vtkGetMacro(Handle, unsigned int);
00129 
00131 
00133   bool Download1D(
00134     int type, void* data,
00135     unsigned int dim,
00136     int numcomps, vtkIdType increment)
00137     {
00138     unsigned int newdims[3];
00139     newdims[0] = dim;
00140     newdims[1] = 1;
00141     newdims[2] = 1;
00142     vtkIdType newincrements[3];
00143     newincrements[0] = increment;
00144     newincrements[1] = 0;
00145     newincrements[2] = 0;
00146     return this->Download3D(type, data, newdims, numcomps, newincrements);
00147     }
00149 
00151 
00153   bool Download2D(
00154     int type, void* data,
00155     unsigned int dims[2],
00156     int numcomps, vtkIdType increments[2])
00157     {
00158     unsigned int newdims[3];
00159     newdims[0] = dims[0];
00160     newdims[1] = dims[1];
00161     newdims[2] = 1;
00162     vtkIdType newincrements[3];
00163     newincrements[0] = increments[0];
00164     newincrements[1] = increments[1];
00165     newincrements[2] =  0;
00166     return this->Download3D(type, data, newdims, numcomps, newincrements);
00167     }
00169 
00171 
00173   bool Download3D(int type, void* data,
00174     unsigned int dims[3],
00175     int numcomps, vtkIdType increments[3]);
00177 
00179 
00180   void BindToPackedBuffer()
00181     { this->Bind(PACKED_BUFFER); }
00183 
00184   void BindToUnPackedBuffer()
00185     { this->Bind(UNPACKED_BUFFER); }
00186 
00188   void UnBind();
00189  
00190 //BTX
00191   // We can't use just PACKED because this is a cygwin macro defined as
00192   // __attribute__((packed))
00193   enum BufferType{
00194     PACKED_BUFFER,
00195     UNPACKED_BUFFER
00196   };
00197 
00199   void Bind(BufferType buffer);
00200 
00202   void ReleaseMemory();
00203 
00205   static bool IsSupported(vtkRenderWindow* renWin);
00206 
00207 //ETX
00208 //BTX
00209 protected:
00210   vtkPixelBufferObject();
00211   ~vtkPixelBufferObject();
00212 
00215   bool LoadRequiredExtensions(vtkOpenGLExtensionManager* mgr);
00216 
00218   void CreateBuffer();
00219 
00221   void DestroyBuffer();
00222 
00223   int BufferTarget;
00224   int Type;
00225   unsigned int Size;
00226   vtkWeakPointer<vtkRenderWindow> Context;
00227   unsigned int Handle;
00228 private:
00229   vtkPixelBufferObject(const vtkPixelBufferObject&); // Not implemented.
00230   void operator=(const vtkPixelBufferObject&); // Not implemented.
00231   //ETX
00232 };
00233 
00234 #endif
00235 
00236 

Generated by  doxygen 1.7.1