00001 /*========================================================================= 00002 00003 Program: Visualization Toolkit 00004 Module: $RCSfile: vtkOpenGLRenderer.h,v $ 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 00029 class VTK_RENDERING_EXPORT vtkOpenGLRenderer : public vtkRenderer 00030 { 00031 protected: 00032 int NumberOfLightsBound; 00033 00034 public: 00035 static vtkOpenGLRenderer *New(); 00036 vtkTypeRevisionMacro(vtkOpenGLRenderer,vtkRenderer); 00037 void PrintSelf(ostream& os, vtkIndent indent); 00038 00040 void DeviceRender(void); 00041 00045 virtual void DeviceRenderTranslucentPolygonalGeometry(); 00046 00049 void ClearLights(void); 00050 00051 void Clear(void); 00052 00054 int UpdateLights(void); 00055 00060 int GetDepthPeelingHigherLayer(); 00061 00062 protected: 00063 vtkOpenGLRenderer(); 00064 ~vtkOpenGLRenderer(); 00065 00067 void CheckCompilation(unsigned int fragmentShader); 00068 00069 //BTX 00070 // Picking functions to be implemented by sub-classes 00071 virtual void DevicePickRender(); 00072 virtual void StartPick(unsigned int pickFromSize); 00073 virtual void UpdatePickId(); 00074 virtual void DonePick(); 00075 virtual unsigned int GetPickedId(); 00076 virtual unsigned int GetNumPickedIds(); 00077 virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer); 00078 virtual double GetPickedZ(); 00079 // Ivars used in picking 00080 class vtkGLPickInfo* PickInfo; 00081 //ETX 00082 double PickedZ; 00083 00088 int RenderPeel(int layer); 00089 00090 //BTX 00091 friend class vtkOpenGLProperty; 00092 friend class vtkOpenGLTexture; 00093 friend class vtkOpenGLImageActor; 00094 //ETX 00095 00098 int GetUseTextureUniformVariable(); 00099 00102 int GetTextureUniformVariable(); 00103 00106 int DepthPeelingIsSupported; 00107 00110 int DepthPeelingIsSupportedChecked; 00111 00113 vtkOpenGLRendererLayerList *LayerList; 00114 00115 unsigned int OpaqueLayerZ; 00116 unsigned int TransparentLayerZ; 00117 unsigned int ProgramShader; 00118 00120 00121 int ViewportX; 00122 int ViewportY; 00123 int ViewportWidth; 00124 int ViewportHeight; 00126 00129 unsigned int DepthFormat; 00130 00131 // Is rendering at translucent geometry stage using depth peeling and 00132 // rendering a layer other than the first one? (Boolean value) 00133 // If so, the uniform variables UseTexture and Texture can be set. 00134 // (Used by vtkOpenGLProperty or vtkOpenGLTexture) 00135 int DepthPeelingHigherLayer; 00136 00137 private: 00138 vtkOpenGLRenderer(const vtkOpenGLRenderer&); // Not implemented. 00139 void operator=(const vtkOpenGLRenderer&); // Not implemented. 00140 }; 00141 00142 #endif