VTK  9.3.1
vtkOpenGLFXAAFilter.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
3 
28 #ifndef vtkOpenGLFXAAFilter_h
29 #define vtkOpenGLFXAAFilter_h
30 
31 #include "vtkFXAAOptions.h" // For DebugOptions enum
32 #include "vtkObject.h"
33 #include "vtkRenderingOpenGL2Module.h" // For export macro
34 
35 #include <string> // For std::string
36 
37 VTK_ABI_NAMESPACE_BEGIN
38 class vtkFXAAOptions;
39 class vtkOpenGLRenderer;
41 class vtkShaderProgram;
42 class vtkTextureObject;
44 
45 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLFXAAFilter : public vtkObject
46 {
47 public:
48  static vtkOpenGLFXAAFilter* New();
50  void PrintSelf(ostream& os, vtkIndent indent) override;
51 
55  void Execute(vtkOpenGLRenderer* ren);
56 
60  void ReleaseGraphicsResources();
61 
67  void UpdateConfiguration(vtkFXAAOptions* opts);
68 
70 
74  vtkSetClampMacro(RelativeContrastThreshold, float, 0.f, 1.f);
75  vtkGetMacro(RelativeContrastThreshold, float);
76  vtkSetClampMacro(HardContrastThreshold, float, 0.f, 1.f);
77  vtkGetMacro(HardContrastThreshold, float);
78  vtkSetClampMacro(SubpixelBlendLimit, float, 0.f, 1.f);
79  vtkGetMacro(SubpixelBlendLimit, float);
80  vtkSetClampMacro(SubpixelContrastThreshold, float, 0.f, 1.f);
81  vtkGetMacro(SubpixelContrastThreshold, float);
82  virtual void SetUseHighQualityEndpoints(bool val);
83  vtkGetMacro(UseHighQualityEndpoints, bool);
84  vtkBooleanMacro(UseHighQualityEndpoints, bool);
85  vtkSetClampMacro(EndpointSearchIterations, int, 0, VTK_INT_MAX);
86  vtkGetMacro(EndpointSearchIterations, int);
87  virtual void SetDebugOptionValue(vtkFXAAOptions::DebugOption opt);
88  vtkGetMacro(DebugOptionValue, vtkFXAAOptions::DebugOption);
90 
91 protected:
93  ~vtkOpenGLFXAAFilter() override;
94 
95  void Prepare();
96  void FreeGLObjects();
97  void CreateGLObjects();
98  void LoadInput();
99  void ApplyFilter();
100  void SubstituteFragmentShader(std::string& fragShader);
101  void Finalize();
102 
103  void StartTimeQuery(vtkOpenGLRenderTimer* timer);
104  void EndTimeQuery(vtkOpenGLRenderTimer* timer);
105  void PrintBenchmark();
106 
107  // Cache GL state that we modify
110 
111  int Viewport[4]; // x, y, width, height
112 
113  // Used to measure execution time:
116 
117  // Parameters:
123 
126 
127  // Set to true when the shader definitions change so we know when to rebuild.
129 
132 
134 
135 private:
136  vtkOpenGLFXAAFilter(const vtkOpenGLFXAAFilter&) = delete;
137  void operator=(const vtkOpenGLFXAAFilter&) = delete;
138 };
139 
140 VTK_ABI_NAMESPACE_END
141 #endif // vtkOpenGLFXAAFilter_h
abstract base class for most VTK objects
Definition: vtkObject.h:51
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
#define VTK_INT_MAX
Definition: vtkType.h:144
vtkOpenGLQuadHelper * QHelper
DebugOption
Debugging options that affect the output color buffer.
a simple class to control print indentation
Definition: vtkIndent.h:28
vtkOpenGLRenderer * Renderer
vtkFXAAOptions::DebugOption DebugOptionValue
abstracts an OpenGL texture object.
vtkOpenGLRenderTimer * FXAATimer
Class to make rendering a full screen quad easier.
vtkTextureObject * Input
vtkOpenGLRenderTimer * PreparationTimer
Perform FXAA antialiasing on the current framebuffer.
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on...
OpenGL renderer.
Asynchronously measures GPU execution time for a single event.
Configuration for FXAA implementations.
The ShaderProgram uses one or more Shader objects.