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 =========================================================================*/ 00025 #ifndef __vtkOpenGLRenderer_h 00026 #define __vtkOpenGLRenderer_h 00027 00028 #include "vtkRenderingOpenGLModule.h" // For export macro 00029 #include "vtkRenderer.h" 00030 00031 class vtkOpenGLRendererLayerList; // Pimpl 00032 class vtkRenderPass; 00033 class vtkShaderProgram2; 00034 00035 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLRenderer : public vtkRenderer 00036 { 00037 public: 00038 static vtkOpenGLRenderer *New(); 00039 vtkTypeMacro(vtkOpenGLRenderer, vtkRenderer); 00040 void PrintSelf(ostream& os, vtkIndent indent); 00041 00043 void DeviceRender(void); 00044 00048 virtual void DeviceRenderTranslucentPolygonalGeometry(); 00049 00052 void ClearLights(void); 00053 00054 void Clear(void); 00055 00057 int UpdateLights(void); 00058 00063 int GetDepthPeelingHigherLayer(); 00064 00065 //BTX 00067 */ 00068 vtkGetObjectMacro(ShaderProgram, vtkShaderProgram2); 00069 virtual void SetShaderProgram(vtkShaderProgram2 *program); 00070 //ETX 00072 00074 00075 void SetPass(vtkRenderPass *p); 00076 vtkGetObjectMacro(Pass, vtkRenderPass); 00078 00079 protected: 00080 vtkOpenGLRenderer(); 00081 ~vtkOpenGLRenderer(); 00082 00084 void CheckCompilation(unsigned int fragmentShader); 00085 00086 // Internal method to release graphics resources in any derived renderers. 00087 virtual void ReleaseGraphicsResources(vtkWindow *w); 00088 00089 //BTX 00090 // Picking functions to be implemented by sub-classes 00091 virtual void DevicePickRender(); 00092 virtual void StartPick(unsigned int pickFromSize); 00093 virtual void UpdatePickId(); 00094 virtual void DonePick(); 00095 virtual unsigned int GetPickedId(); 00096 virtual unsigned int GetNumPickedIds(); 00097 virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer); 00098 virtual double GetPickedZ(); 00099 00100 // Ivars used in picking 00101 class vtkGLPickInfo* PickInfo; 00102 //ETX 00103 00104 double PickedZ; 00105 00106 int NumberOfLightsBound; 00111 int RenderPeel(int layer); 00112 00113 //BTX 00114 friend class vtkOpenGLProperty; 00115 friend class vtkOpenGLTexture; 00116 friend class vtkOpenGLImageSliceMapper; 00117 friend class vtkOpenGLImageResliceMapper; 00118 //ETX 00119 00122 int GetUseTextureUniformVariable(); 00123 00126 int GetTextureUniformVariable(); 00127 00130 int DepthPeelingIsSupported; 00131 00134 int DepthPeelingIsSupportedChecked; 00135 00137 vtkOpenGLRendererLayerList *LayerList; 00138 00139 unsigned int OpaqueLayerZ; 00140 unsigned int TransparentLayerZ; 00141 unsigned int ProgramShader; 00142 00144 00145 int ViewportX; 00146 int ViewportY; 00147 int ViewportWidth; 00148 int ViewportHeight; 00150 00153 unsigned int DepthFormat; 00154 00155 // Is rendering at translucent geometry stage using depth peeling and 00156 // rendering a layer other than the first one? (Boolean value) 00157 // If so, the uniform variables UseTexture and Texture can be set. 00158 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00159 int DepthPeelingHigherLayer; 00160 00161 vtkShaderProgram2 *ShaderProgram; 00162 00163 friend class vtkRenderPass; 00164 vtkRenderPass *Pass; 00165 00166 private: 00167 vtkOpenGLRenderer(const vtkOpenGLRenderer&); // Not implemented. 00168 void operator=(const vtkOpenGLRenderer&); // Not implemented. 00169 }; 00170 00171 #endif