VTK  9.3.0
vtkOpenGLRenderer.h
Go to the documentation of this file.
1// SPDX-FileCopyrightText: Copyright (c) Ken Martin, Will Schroeder, Bill Lorensen
2// SPDX-License-Identifier: BSD-3-Clause
23#ifndef vtkOpenGLRenderer_h
24#define vtkOpenGLRenderer_h
25
26#include "vtkRenderer.h"
27
28#include "vtkOpenGLQuadHelper.h" // for ivar
29#include "vtkRenderingOpenGL2Module.h" // For export macro
30#include "vtkSmartPointer.h" // For vtkSmartPointer
31#include <memory> // for unique_ptr
32#include <string> // Ivars
33#include <vector> // STL Header
34
35VTK_ABI_NAMESPACE_BEGIN
36class vtkFloatArray;
38class vtkRenderPass;
39class vtkOpenGLState;
49class vtkSSAOPass;
50
51class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLRenderer : public vtkRenderer
52{
53public:
56 void PrintSelf(ostream& os, vtkIndent indent) override;
57
61 void DeviceRender() override;
62
67
75
76 void Clear() override;
77
81 int UpdateLights() override;
82
90
96
103
104 // Get the state object used to keep track of
105 // OpenGL state
107
108 // get the standard lighting uniform declarations
109 // for the current set of lights
110 const char* GetLightingUniforms();
111
112 // update the lighting uniforms for this shader if they
113 // are out of date
115
116 // get the complexity of the current lights as a int
117 // 0 = no lighting
118 // 1 = headlight
119 // 2 = directional lights
120 // 3 = positional lights
122 {
123 NoLighting = 0,
124 Headlight = 1,
125 Directional = 2,
126 Positional = 3
127 };
128 vtkGetMacro(LightingComplexity, int);
129
130 // get the number of lights turned on
131 vtkGetMacro(LightingCount, int);
132
134
141
143
150
155
157
160 vtkSetMacro(UseSphericalHarmonics, bool);
161 vtkGetMacro(UseSphericalHarmonics, bool);
162 vtkBooleanMacro(UseSphericalHarmonics, bool);
164
168 void SetEnvironmentTexture(vtkTexture* texture, bool isSRGB = false) override;
169
170 // Method to release graphics resources
172
173protected:
176
180 void CheckCompilation(unsigned int fragmentShader);
181
187 int UpdateGeometry(vtkFrameBufferObjectBase* fbo = nullptr) override;
188
195
196 friend class vtkOpenGLProperty;
197 friend class vtkOpenGLTexture;
199 friend class vtkOpenGLImageResliceMapper;
200
205
210
215
220
225
226 // Is rendering at translucent geometry stage using depth peeling and
227 // rendering a layer other than the first one? (Boolean value)
228 // If so, the uniform variables UseTexture and Texture can be set.
229 // (Used by vtkOpenGLProperty or vtkOpenGLTexture)
231
232 friend class vtkRenderPass;
233
238
243
248 std::unique_ptr<vtkOpenGLQuadHelper> BackgroundRenderer;
250
251private:
252 vtkOpenGLRenderer(const vtkOpenGLRenderer&) = delete;
253 void operator=(const vtkOpenGLRenderer&) = delete;
254};
255
256VTK_ABI_NAMESPACE_END
257#endif
Implement Depth Peeling for use within a framebuffer pass.
dynamic, self-adjusting array of float
abstract interface to OpenGL FBOs
a simple class to control print indentation
Definition vtkIndent.h:38
Perform FXAA antialiasing on the current framebuffer.
OpenGL mapper for image slice display.
OpenGL property.
OpenGL renderer.
vtkPBRPrefilterTexture * GetEnvMapPrefiltered()
Get environment textures used for image based lighting.
std::unique_ptr< vtkOpenGLQuadHelper > BackgroundRenderer
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkPBRPrefilterTexture * EnvMapPrefiltered
void SetEnvironmentTexture(vtkTexture *texture, bool isSRGB=false) override
Overridden in order to connect the texture to the environment map textures.
vtkSmartPointer< vtkFloatArray > SphericalHarmonics
vtkPBRLUTTexture * GetEnvMapLookupTable()
Get environment textures used for image based lighting.
vtkShadowMapPass * ShadowMapPass
Shadows are delegated to an instance of vtkShadowMapPass.
vtkOpenGLState * GetState()
vtkPBRIrradianceTexture * EnvMapIrradiance
std::string LightingDeclaration
vtkDepthPeelingPass * DepthPeelingPass
Depth peeling is delegated to an instance of vtkDepthPeelingPass.
vtkPBRLUTTexture * EnvMapLookupTable
static bool HaveAppleQueryAllocationBug()
Indicate if this system is subject to the apple/NVIDIA bug that causes crashes in the driver when too...
vtkSSAOPass * SSAOPass
SSAO is delegated to an instance of vtkSSAOPass.
bool IsDualDepthPeelingSupported()
Dual depth peeling may be disabled for certain runtime configurations.
vtkSmartPointer< vtkTransform > UserLightTransform
Optional user transform for lights.
vtkTransform * GetUserLightTransform()
Set the user light transform applied after the camera transform.
void DeviceRenderTranslucentPolygonalGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Render translucent polygonal geometry.
vtkTexture * GetCurrentTexturedBackground()
Check and return the textured background for the current state If monocular or stereo left eye,...
const char * GetLightingUniforms()
int UpdateLights() override
Ask lights to load themselves into graphics pipeline.
vtkOrderIndependentTranslucentPass * TranslucentPass
Fallback for transparency.
vtkMTimeType LightingUpdateTime
void DeviceRenderOpaqueGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Overridden to support hidden line removal.
static vtkOpenGLRenderer * New()
vtkOpenGLFXAAFilter * FXAAFilter
FXAA is delegated to an instance of vtkOpenGLFXAAFilter.
void ReleaseGraphicsResources(vtkWindow *w) override
void DeviceRender() override
Concrete open gl render method.
vtkPBRIrradianceTexture * GetEnvMapIrradiance()
Get environment textures used for image based lighting.
int UpdateGeometry(vtkFrameBufferObjectBase *fbo=nullptr) override
Ask all props to update and draw any opaque and translucent geometry.
void UpdateLightingUniforms(vtkShaderProgram *prog)
void SetUserLightTransform(vtkTransform *transform)
Set the user light transform applied after the camera transform.
vtkFloatArray * GetSphericalHarmonics()
Get spherical harmonics coefficients used for irradiance.
void Clear() override
Clear the image to the background color.
~vtkOpenGLRenderer() override
void CheckCompilation(unsigned int fragmentShader)
Check the compilation status of some fragment shader source.
int GetDepthPeelingHigherLayer()
Is rendering at translucent geometry stage using depth peeling and rendering a layer other than the f...
OpenGL state storage.
OpenGL texture map.
Implement OIT rendering using average color.
precompute irradiance texture used in physically based rendering
precompute BRDF look-up table texture used in physically based rendering
precompute prefilter texture used in physically based rendering
Perform part of the rendering of a vtkRenderer.
abstract specification for renderers
Definition vtkRenderer.h:68
Implement a screen-space ambient occlusion pass.
Definition vtkSSAOPass.h:35
The ShaderProgram uses one or more Shader objects.
Implement a shadow mapping render pass.
Hold a reference to a vtkObjectBase instance.
abstracts an OpenGL texture object.
handles properties associated with a texture map
Definition vtkTexture.h:67
describes linear transformations via a 4x4 matrix
window superclass for vtkRenderWindow
Definition vtkWindow.h:34
vtkTypeUInt32 vtkMTimeType
Definition vtkType.h:270