VTK
|
00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: vtkOpenGLRenderer.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 =========================================================================*/ 00022 #ifndef __vtkOpenGLRenderer_h 00023 #define __vtkOpenGLRenderer_h 00024 00025 #include "vtkRenderer.h" 00026 00027 class vtkOpenGLRendererLayerList; // Pimpl 00028 class vtkShaderProgram2; 00029 00030 class VTK_RENDERING_EXPORT vtkOpenGLRenderer : public vtkRenderer 00031 { 00032 protected: 00033 int NumberOfLightsBound; 00034 00035 public: 00036 static vtkOpenGLRenderer *New(); 00037 vtkTypeMacro(vtkOpenGLRenderer,vtkRenderer); 00038 void PrintSelf(ostream& os, vtkIndent indent); 00039 00041 void DeviceRender(void); 00042 00046 virtual void DeviceRenderTranslucentPolygonalGeometry(); 00047 00050 void ClearLights(void); 00051 00052 void Clear(void); 00053 00055 int UpdateLights(void); 00056 00061 int GetDepthPeelingHigherLayer(); 00062 00063 //BTX 00065 */ 00066 vtkGetObjectMacro(ShaderProgram,vtkShaderProgram2); 00067 virtual void SetShaderProgram(vtkShaderProgram2 *program); 00068 //ETX 00070 00071 protected: 00072 vtkOpenGLRenderer(); 00073 ~vtkOpenGLRenderer(); 00074 00076 void CheckCompilation(unsigned int fragmentShader); 00077 00078 //BTX 00079 // Picking functions to be implemented by sub-classes 00080 virtual void DevicePickRender(); 00081 virtual void StartPick(unsigned int pickFromSize); 00082 virtual void UpdatePickId(); 00083 virtual void DonePick(); 00084 virtual unsigned int GetPickedId(); 00085 virtual unsigned int GetNumPickedIds(); 00086 virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer); 00087 virtual double GetPickedZ(); 00088 // Ivars used in picking 00089 class vtkGLPickInfo* PickInfo; 00090 //ETX 00091 double PickedZ; 00092 00097 int RenderPeel(int layer); 00098 00099 //BTX 00100 friend class vtkOpenGLProperty; 00101 friend class vtkOpenGLTexture; 00102 friend class vtkOpenGLImageSliceMapper; 00103 friend class vtkOpenGLImageResliceMapper; 00104 //ETX 00105 00108 int GetUseTextureUniformVariable(); 00109 00112 int GetTextureUniformVariable(); 00113 00116 int DepthPeelingIsSupported; 00117 00120 int DepthPeelingIsSupportedChecked; 00121 00123 vtkOpenGLRendererLayerList *LayerList; 00124 00125 unsigned int OpaqueLayerZ; 00126 unsigned int TransparentLayerZ; 00127 unsigned int ProgramShader; 00128 00130 00131 int ViewportX; 00132 int ViewportY; 00133 int ViewportWidth; 00134 int ViewportHeight; 00136 00139 unsigned int DepthFormat; 00140 00141 // Is rendering at translucent geometry stage using depth peeling and 00142 // rendering a layer other than the first one? (Boolean value) 00143 // If so, the uniform variables UseTexture and Texture can be set. 00144 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00145 int DepthPeelingHigherLayer; 00146 00147 vtkShaderProgram2 *ShaderProgram; 00148 00149 private: 00150 vtkOpenGLRenderer(const vtkOpenGLRenderer&); // Not implemented. 00151 void operator=(const vtkOpenGLRenderer&); // Not implemented. 00152 }; 00153 00154 #endif