VTK
vtkOpenGLHAVSVolumeMapper.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3 Program: Visualization Toolkit
4 Module: vtkOpenGLHAVSVolumeMapper.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 =========================================================================*/
15 
16 /* Copyright 2005, 2006 by University of Utah. */
17 
117 #ifndef __vtkOpenGLHAVSVolumeMapper_h
118 #define __vtkOpenGLHAVSVolumeMapper_h
119 
120 #include "vtkHAVSVolumeMapper.h"
121 
122 #include <vtkWeakPointer.h> // to cache the vtkRenderWindow
123 class vtkRenderer;
124 class vtkRenderWindow;
125 
126 
128 {
129 public:
130  static vtkOpenGLHAVSVolumeMapper *New();
131  vtkTypeMacro(vtkOpenGLHAVSVolumeMapper,
133  virtual void PrintSelf(ostream& os, vtkIndent indent);
134 
136  virtual void Render(vtkRenderer *ren, vtkVolume *vol);
137 
140  virtual void ReleaseGraphicsResources(vtkWindow *);
141 
144  virtual void SetGPUDataStructures(bool);
145 
147 
151  virtual bool SupportedByHardware(vtkRenderer *r);
152 protected:
154 
158 
159 //BTX
160  virtual void Initialize(vtkRenderer *ren, vtkVolume *vol);
161  virtual void InitializeLookupTables(vtkVolume *vol);
162  void InitializeGPUDataStructures();
163  void InitializeShaders();
164  void DeleteShaders();
165  void InitializeFramebufferObject();
166 
167  void RenderHAVS(vtkRenderer *ren);
168  void SetupFBOZBuffer(int screenWidth, int screenHeight, float depthNear, float depthFar,
169  float *zbuffer);
170  void SetupFBOMRT();
171  void DrawFBOInit(int screenWidth, int screenHeight, float depthNear, float depthFar);
172  void DrawFBOGeometry();
173  void DrawFBOFlush(int screenWidth, int screenHeight, float depthNear, float depthFar);
174  void DrawBlend(int screenWidth, int screenHeight, float depthNear, float depthFar);
175 
176  void CheckOpenGLError(const char *str);
177 
178  // GPU
179  unsigned int VBOVertexName;
180  unsigned int VBOTexCoordName;
181  unsigned int VBOVertexIndexName;
182  unsigned int VertexProgram;
183  unsigned int FragmentProgramBegin;
184  unsigned int FragmentProgram;
185  unsigned int FragmentProgramEnd;
186  unsigned int FramebufferObject;
188  unsigned int FramebufferTextures[4];
189  unsigned int DepthTexture;
190 
191  // Lookup Tables
192  unsigned int PsiTableTexture;
194 
196 //ETX
197 
198 private:
199  vtkOpenGLHAVSVolumeMapper(const vtkOpenGLHAVSVolumeMapper&); // Not implemented.
200  void operator=(const vtkOpenGLHAVSVolumeMapper&); // Not implemented.
201 };
202 
203 #endif