00001 
00002 
00003 
00004 
00005 
00006 
00007 
00008 
00009 
00010 
00011 
00012 
00013 
00014 
00015 
00016 
00017 
00117 #ifndef __vtkOpenGLHAVSVolumeMapper_h
00118 #define __vtkOpenGLHAVSVolumeMapper_h
00119 
00120 #include "vtkHAVSVolumeMapper.h"
00121 
00122 #include <vtkWeakPointer.h> 
00123 class vtkRenderer;
00124 class vtkRenderWindow;
00125 
00126 
00127 class VTK_VOLUMERENDERING_EXPORT vtkOpenGLHAVSVolumeMapper : public vtkHAVSVolumeMapper
00128 {
00129 public:
00130   static vtkOpenGLHAVSVolumeMapper *New();
00131   vtkTypeMacro(vtkOpenGLHAVSVolumeMapper,
00132                        vtkHAVSVolumeMapper);
00133   virtual void PrintSelf(ostream& os, vtkIndent indent);
00134   
00136   virtual void Render(vtkRenderer *ren, vtkVolume *vol);
00137 
00140   virtual void ReleaseGraphicsResources(vtkWindow *);
00141 
00144   virtual void SetGPUDataStructures(bool);
00145 
00147 
00151   virtual bool SupportedByHardware(vtkRenderer *r);
00152 protected:
00154 
00155   vtkOpenGLHAVSVolumeMapper();
00156   ~vtkOpenGLHAVSVolumeMapper();
00157   virtual int FillInputPortInformation(int port, vtkInformation* info);
00158 
00159 
00160   virtual void Initialize(vtkRenderer *ren, vtkVolume *vol);
00161   virtual void InitializeLookupTables(vtkVolume *vol);
00162   void InitializeGPUDataStructures();
00163   void InitializeShaders();
00164   void DeleteShaders();
00165   void InitializeFramebufferObject();
00166 
00167   void RenderHAVS(vtkRenderer *ren);
00168   void SetupFBOZBuffer(int screenWidth, int screenHeight, float depthNear, float depthFar, 
00169                        float *zbuffer);
00170   void SetupFBOMRT();
00171   void DrawFBOInit(int screenWidth, int screenHeight, float depthNear, float depthFar);
00172   void DrawFBOGeometry();
00173   void DrawFBOFlush(int screenWidth, int screenHeight, float depthNear, float depthFar);
00174   void DrawBlend(int screenWidth, int screenHeight, float depthNear, float depthFar);
00175 
00176   void CheckOpenGLError(const char *str);
00177 
00178   
00179   unsigned int VBOVertexName;
00180   unsigned int VBOTexCoordName;
00181   unsigned int VBOVertexIndexName;
00182   unsigned int VertexProgram;
00183   unsigned int FragmentProgramBegin;
00184   unsigned int FragmentProgram;
00185   unsigned int FragmentProgramEnd;
00186   unsigned int FramebufferObject;
00187   int FramebufferObjectSize;
00188   unsigned int FramebufferTextures[4];
00189   unsigned int DepthTexture;
00190 
00191   
00192   unsigned int PsiTableTexture;
00193   unsigned int TransferFunctionTexture;
00194 
00195   vtkWeakPointer<vtkRenderWindow> RenderWindow;
00196 
00197 
00198 private:
00199   vtkOpenGLHAVSVolumeMapper(const vtkOpenGLHAVSVolumeMapper&);  
00200   void operator=(const vtkOpenGLHAVSVolumeMapper&);  
00201 };
00202 
00203 #endif