VTK
vtkOpenGLRenderer.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLRenderer.h
5 
6  Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
7  All rights reserved.
8  See Copyright.txt or http://www.kitware.com/Copyright.htm for details.
9 
10  This software is distributed WITHOUT ANY WARRANTY; without even
11  the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
12  PURPOSE. See the above copyright notice for more information.
13 
14 =========================================================================*/
23 #ifndef vtkOpenGLRenderer_h
24 #define vtkOpenGLRenderer_h
25 
26 #include "vtkRenderingOpenGLModule.h" // For export macro
27 #include "vtkRenderer.h"
28 
29 class vtkOpenGLRendererLayerList; // Pimpl
30 class vtkRenderPass;
31 class vtkShaderProgram2;
32 
33 class VTKRENDERINGOPENGL_EXPORT vtkOpenGLRenderer : public vtkRenderer
34 {
35 public:
36  static vtkOpenGLRenderer *New();
38  void PrintSelf(ostream& os, vtkIndent indent);
39 
43  void DeviceRender(void);
44 
48  virtual void DeviceRenderOpaqueGeometry();
49 
57 
62  virtual void ClearLights(void);
63 
64  virtual void Clear(void);
65 
69  int UpdateLights(void);
70 
77  int GetDepthPeelingHigherLayer();
78 
80 
83  vtkGetObjectMacro(ShaderProgram, vtkShaderProgram2);
84  virtual void SetShaderProgram(vtkShaderProgram2 *program);
86 
87 protected:
90 
94  void CheckCompilation(unsigned int fragmentShader);
95 
96  // Internal method to release graphics resources in any derived renderers.
97  virtual void ReleaseGraphicsResources(vtkWindow *w);
98 
99  // Picking functions to be implemented by sub-classes
100  virtual void DevicePickRender();
101  virtual void StartPick(unsigned int pickFromSize);
102  virtual void UpdatePickId();
103  virtual void DonePick();
104  virtual unsigned int GetPickedId();
105  virtual unsigned int GetNumPickedIds();
106  virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer);
107  virtual double GetPickedZ();
108 
109  // Ivars used in picking
110  class vtkGLPickInfo* PickInfo;
111 
112  double PickedZ;
113 
121  int RenderPeel(int layer);
122 
123  friend class vtkOpenGLProperty;
124  friend class vtkOpenGLTexture;
126  friend class vtkOpenGLImageResliceMapper;
127 
132  int GetUseTextureUniformVariable();
133 
138  int GetTextureUniformVariable();
139 
145 
151 
155  vtkOpenGLRendererLayerList *LayerList;
156 
157  unsigned int OpaqueLayerZ;
158  unsigned int TransparentLayerZ;
159  unsigned int ProgramShader;
160 
162 
170 
175  unsigned int DepthFormat;
176 
177  // Is rendering at translucent geometry stage using depth peeling and
178  // rendering a layer other than the first one? (Boolean value)
179  // If so, the uniform variables UseTexture and Texture can be set.
180  // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
182 
184 
185  friend class vtkRenderPass;
186 
187 private:
188  vtkOpenGLRenderer(const vtkOpenGLRenderer&) VTK_DELETE_FUNCTION;
189  void operator=(const vtkOpenGLRenderer&) VTK_DELETE_FUNCTION;
190 };
191 
192 #endif
virtual double GetPickedZ()=0
Return the Z value for the last picked Prop.
virtual void ReleaseGraphicsResources(vtkWindow *)
virtual void ClearLights(void)
Internal method temporarily removes lights before reloading them into graphics pipeline.
Definition: vtkRenderer.h:319
virtual int UpdateLights(void)
Ask all lights to load themselves into rendering pipeline.
Definition: vtkRenderer.h:862
abstract specification for renderers
Definition: vtkRenderer.h:63
virtual int GetPickedIds(unsigned int atMost, unsigned int *callerBuffer)=0
OpenGL property.
OpenGL mapper for image slice display.
OpenGL texture map.
virtual void UpdatePickId()=0
window superclass for vtkRenderWindow
Definition: vtkWindow.h:37
GLSL Program.
virtual void DeviceRender()=0
Create an image.
void PrintSelf(ostream &os, vtkIndent indent)
Methods invoked by print to print information about the object including superclasses.
a simple class to control print indentation
Definition: vtkIndent.h:39
int ViewportWidth
Cache viewport values for depth peeling.
virtual void DeviceRenderTranslucentPolygonalGeometry()
Render translucent polygonal geometry.
int DepthPeelingIsSupportedChecked
This flag is on once the OpenGL extensions required by the depth peeling technique have been checked...
virtual void DeviceRenderOpaqueGeometry()
Render opaque polygonal geometry.
vtkOpenGLRendererLayerList * LayerList
Used by the depth peeling technique to store the transparency layers.
vtkShaderProgram2 * ShaderProgram
virtual unsigned int GetPickedId()=0
int ViewportX
Cache viewport values for depth peeling.
virtual void StartPick(unsigned int pickFromSize)=0
int ViewportHeight
Cache viewport values for depth peeling.
virtual unsigned int GetNumPickedIds()=0
int ViewportY
Cache viewport values for depth peeling.
int DepthPeelingIsSupported
This flag is on if the current OpenGL context supports extensions required by the depth peeling techn...
unsigned int OpaqueLayerZ
static vtkRenderer * New()
Create a vtkRenderer with a black background, a white ambient light, two-sided lighting turned on...
virtual void DevicePickRender()=0
Perform part of the rendering of a vtkRenderer.
Definition: vtkRenderPass.h:58
OpenGL renderer.
class vtkGLPickInfo * PickInfo
unsigned int DepthFormat
Actual depth format: vtkgl::DEPTH_COMPONENT16_ARB or vtkgl::DEPTH_COMPONENT24_ARB.
virtual void DonePick()=0
unsigned int TransparentLayerZ
virtual void Clear()
Clear the image to the background color.
Definition: vtkRenderer.h:324
unsigned int ProgramShader