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 vtkOpenGLImageActor; 00103 //ETX 00104 00107 int GetUseTextureUniformVariable(); 00108 00111 int GetTextureUniformVariable(); 00112 00115 int DepthPeelingIsSupported; 00116 00119 int DepthPeelingIsSupportedChecked; 00120 00122 vtkOpenGLRendererLayerList *LayerList; 00123 00124 unsigned int OpaqueLayerZ; 00125 unsigned int TransparentLayerZ; 00126 unsigned int ProgramShader; 00127 00129 00130 int ViewportX; 00131 int ViewportY; 00132 int ViewportWidth; 00133 int ViewportHeight; 00135 00138 unsigned int DepthFormat; 00139 00140 // Is rendering at translucent geometry stage using depth peeling and 00141 // rendering a layer other than the first one? (Boolean value) 00142 // If so, the uniform variables UseTexture and Texture can be set. 00143 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00144 int DepthPeelingHigherLayer; 00145 00146 vtkShaderProgram2 *ShaderProgram; 00147 00148 private: 00149 vtkOpenGLRenderer(const vtkOpenGLRenderer&); // Not implemented. 00150 void operator=(const vtkOpenGLRenderer&); // Not implemented. 00151 }; 00152 00153 #endif