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  virtual void Render(vtkRenderer *ren, vtkVolume *vol);
142 
147  virtual void ReleaseGraphicsResources(vtkWindow *);
148 
153  virtual void SetGPUDataStructures(bool);
154 
161  virtual bool SupportedByHardware(vtkRenderer *r);
162 protected:
163 
167 
168  virtual void Initialize(vtkRenderer *ren, vtkVolume *vol);
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;
196  unsigned int FramebufferTextures[4];
197  unsigned int DepthTexture;
198 
199  // Lookup Tables
200  unsigned int PsiTableTexture;
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
void InitializeLookupTables(vtkVolume *vol)
virtual void Render(vtkRenderer *ren, vtkVolume *vol)=0
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE DO NOT USE THIS METHOD OUTSIDE OF THE RENDERI...
virtual int FillInputPortInformation(int, vtkInformation *)
Fill the input port information objects for this algorithm.
Store vtkAlgorithm input/output information.
vtkWeakPointer< vtkRenderWindow > RenderWindow
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
virtual bool SupportedByHardware(vtkRenderer *vtkNotUsed(r))
Check hardware support for the HAVS algorithm.
abstract specification for renderers
Definition: vtkRenderer.h:63
static vtkHAVSVolumeMapper * New()
virtual void Initialize(vtkRenderer *ren, vtkVolume *vol)=0
virtual void SetGPUDataStructures(bool)=0
Set/get whether or not the data structures should be stored on the GPU for better peformance...
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
a simple class to control print indentation
Definition: vtkIndent.h:39
create a window for renderers to draw into
Hardware-Assisted Visibility Sorting unstructured grid mapper, OpenGL implementation.
virtual void ReleaseGraphicsResources(vtkWindow *)
WARNING: INTERNAL METHOD - NOT INTENDED FOR GENERAL USE Release any graphics resources that are being...
Hardware-Assisted Visibility Sorting unstructured grid mapper.