VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLImageSliceMapper.h 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 =========================================================================*/ 00025 #ifndef __vtkOpenGLImageSliceMapper_h 00026 #define __vtkOpenGLImageSliceMapper_h 00027 00028 #include "vtkRenderingOpenGLModule.h" // For export macro 00029 #include "vtkImageSliceMapper.h" 00030 00031 class vtkWindow; 00032 class vtkRenderer; 00033 class vtkRenderWindow; 00034 class vtkOpenGLRenderWindow; 00035 class vtkImageSlice; 00036 class vtkImageProperty; 00037 class vtkImageData; 00038 00039 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLImageSliceMapper : 00040 public vtkImageSliceMapper 00041 { 00042 public: 00043 static vtkOpenGLImageSliceMapper *New(); 00044 vtkTypeMacro(vtkOpenGLImageSliceMapper, vtkImageSliceMapper); 00045 virtual void PrintSelf(ostream& os, vtkIndent indent); 00046 00048 void Render(vtkRenderer *ren, vtkImageSlice *prop); 00049 00053 void ReleaseGraphicsResources(vtkWindow *); 00054 00055 protected: 00056 vtkOpenGLImageSliceMapper(); 00057 ~vtkOpenGLImageSliceMapper(); 00058 00060 00061 void RenderColorAndLighting( 00062 double red, double green, double blue, 00063 double alpha, double ambient, double diffuse); 00065 00067 00070 void RecursiveRenderTexturedPolygon( 00071 vtkRenderer *ren, vtkImageProperty *property, 00072 vtkImageData *image, int extent[6], bool recursive); 00074 00076 00078 void RenderTexturedPolygon( 00079 vtkRenderer *ren, vtkImageProperty *property, 00080 vtkImageData *image, int extent[6], bool recursive); 00082 00085 void RenderPolygon(vtkPoints *points, const int extent[6], bool textured); 00086 00088 00091 void RenderBackground( 00092 vtkPoints *points, const int extent[6], bool textured); 00094 00096 void BindFragmentProgram(vtkRenderer *ren, vtkImageProperty *property); 00097 00099 vtkStdString BuildFragmentProgram(vtkImageProperty *property); 00100 00102 00107 void ComputeTextureSize( 00108 const int extent[6], int &xdim, int &ydim, 00109 int imageSize[2], int textureSize[2]); 00111 00114 bool TextureSizeOK(const int size[2]); 00115 00117 void CheckOpenGLCapabilities(vtkOpenGLRenderWindow *renWin); 00118 00119 long TextureIndex; // OpenGL ID for texture or display list 00120 long BackgroundTextureIndex; // OpenGL ID for texture or display list 00121 long FragmentShaderIndex; // OpenGL ID for fragment shader 00122 vtkRenderWindow *RenderWindow; // RenderWindow used for previous render 00123 int TextureSize[2]; 00124 int TextureBytesPerPixel; 00125 int LastOrientation; 00126 int LastSliceNumber; 00127 00128 vtkTimeStamp LoadTime; 00129 int LoadCount; 00130 00131 bool UsePowerOfTwoTextures; 00132 bool UseClampToEdge; 00133 bool UseFragmentProgram; 00134 00135 private: 00136 vtkOpenGLImageSliceMapper(const vtkOpenGLImageSliceMapper&); // Not implemented. 00137 void operator=(const vtkOpenGLImageSliceMapper&); // Not implemented. 00138 }; 00139 00140 #endif