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 
118 #ifndef vtkOpenGLHAVSVolumeMapper_h
119 #define vtkOpenGLHAVSVolumeMapper_h
120 
121 #include "vtkRenderingVolumeOpenGLModule.h" // For export macro
122 #include "vtkHAVSVolumeMapper.h"
123 
124 #include "vtkWeakPointer.h" // to cache the vtkRenderWindow
125 class vtkRenderer;
126 class vtkRenderWindow;
127 
128 
129 class VTKRENDERINGVOLUMEOPENGL_EXPORT vtkOpenGLHAVSVolumeMapper
130  : public vtkHAVSVolumeMapper
131 {
132 public:
133  static vtkOpenGLHAVSVolumeMapper *New();
134  vtkTypeMacro(vtkOpenGLHAVSVolumeMapper,
136  void PrintSelf(ostream& os, vtkIndent indent) VTK_OVERRIDE;
137 
141  void Render(vtkRenderer *ren, vtkVolume *vol) VTK_OVERRIDE;
142 
147  void ReleaseGraphicsResources(vtkWindow *) VTK_OVERRIDE;
148 
153  void SetGPUDataStructures(bool) VTK_OVERRIDE;
154 
161  bool SupportedByHardware(vtkRenderer *r) VTK_OVERRIDE;
162 protected:
163 
165  ~vtkOpenGLHAVSVolumeMapper() VTK_OVERRIDE;
166  int FillInputPortInformation(int port, vtkInformation* info) VTK_OVERRIDE;
167 
168  void Initialize(vtkRenderer *ren, vtkVolume *vol) VTK_OVERRIDE;
169  virtual void InitializeLookupTables(vtkVolume *vol);
170  void InitializeGPUDataStructures();
171  void InitializeShaders();
172  void DeleteShaders();
173  void InitializeFramebufferObject();
174 
175  void RenderHAVS(vtkRenderer *ren);
176  void SetupFBOZBuffer(int screenWidth, int screenHeight, float depthNear, float depthFar,
177  float *zbuffer);
178  void SetupFBOMRT();
179  void DrawFBOInit(int screenWidth, int screenHeight, float depthNear, float depthFar);
180  void DrawFBOGeometry();
181  void DrawFBOFlush(int screenWidth, int screenHeight, float depthNear, float depthFar);
182  void DrawBlend(int screenWidth, int screenHeight, float depthNear, float depthFar);
183 
184  void CheckOpenGLError(const char *str);
185 
186  // GPU
187  unsigned int VBOVertexName;
188  unsigned int VBOTexCoordName;
189  unsigned int VBOVertexIndexName;
190  unsigned int VertexProgram;
191  unsigned int FragmentProgramBegin;
192  unsigned int FragmentProgram;
193  unsigned int FragmentProgramEnd;
194  unsigned int FramebufferObject;
195  int FramebufferObjectSize;
196  unsigned int FramebufferTextures[4];
197  unsigned int DepthTexture;
198 
199  // Lookup Tables
200  unsigned int PsiTableTexture;
201  unsigned int TransferFunctionTexture;
202 
204 
205 private:
206  vtkOpenGLHAVSVolumeMapper(const vtkOpenGLHAVSVolumeMapper&) VTK_DELETE_FUNCTION;
207  void operator=(const vtkOpenGLHAVSVolumeMapper&) VTK_DELETE_FUNCTION;
208 };
209 
210 #endif
represents a volume (data & properties) in a rendered scene
Definition: vtkVolume.h:50
Store vtkAlgorithm input/output information.
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
abstract specification for renderers
Definition: vtkRenderer.h:63
static vtkHAVSVolumeMapper * New()
void Render(vtkRenderer *ren, vtkVolume *vol) override=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
void ReleaseGraphicsResources(vtkWindow *) override
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
a weak reference to a vtkObject.
create a window for renderers to draw into
Hardware-Assisted Visibility Sorting unstructured grid mapper, OpenGL implementation.
Hardware-Assisted Visibility Sorting unstructured grid mapper.