VTK
vtkOpenGLFXAAFilter.h
Go to the documentation of this file.
1 /*=========================================================================
2 
3  Program: Visualization Toolkit
4  Module: vtkOpenGLFXAAFilter.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 =========================================================================*/
15 
40 #ifndef vtkOpenGLFXAAFilter_h
41 #define vtkOpenGLFXAAFilter_h
42 
43 #include "vtkFXAAOptions.h" // For DebugOptions enum
44 #include "vtkObject.h"
45 #include "vtkRenderingOpenGL2Module.h" // For export macro
46 
47 #include <string> // For std::string
48 
49 class vtkFXAAOptions;
50 class vtkOpenGLRenderer;
52 class vtkShaderProgram;
53 class vtkTextureObject;
55 
56 class VTKRENDERINGOPENGL2_EXPORT vtkOpenGLFXAAFilter: public vtkObject
57 {
58 public:
59  static vtkOpenGLFXAAFilter* New();
61  void PrintSelf(ostream &os, vtkIndent indent) override;
62 
66  void Execute(vtkOpenGLRenderer *ren);
67 
71  void ReleaseGraphicsResources();
72 
78  void UpdateConfiguration(vtkFXAAOptions *opts);
79 
81 
85  vtkSetClampMacro(RelativeContrastThreshold, float, 0.f, 1.f)
86  vtkGetMacro(RelativeContrastThreshold, float)
87  vtkSetClampMacro(HardContrastThreshold, float, 0.f, 1.f)
88  vtkGetMacro(HardContrastThreshold, float)
89  vtkSetClampMacro(SubpixelBlendLimit, float, 0.f, 1.f)
90  vtkGetMacro(SubpixelBlendLimit, float)
91  vtkSetClampMacro(SubpixelContrastThreshold, float, 0.f, 1.f)
92  vtkGetMacro(SubpixelContrastThreshold, float)
93  virtual void SetUseHighQualityEndpoints(bool val);
94  vtkGetMacro(UseHighQualityEndpoints, bool)
95  vtkBooleanMacro(UseHighQualityEndpoints, bool)
96  vtkSetClampMacro(EndpointSearchIterations, int, 0, VTK_INT_MAX)
97  vtkGetMacro(EndpointSearchIterations, int)
98  virtual void SetDebugOptionValue(vtkFXAAOptions::DebugOption opt);
99  vtkGetMacro(DebugOptionValue, vtkFXAAOptions::DebugOption)
101 
102 protected:
104  ~vtkOpenGLFXAAFilter() override;
105 
106  void Prepare();
107  void FreeGLObjects();
108  void CreateGLObjects();
109  void LoadInput();
110  void ApplyFilter();
111  void SubstituteFragmentShader(std::string &fragShader);
112  void Finalize();
113 
114  void StartTimeQuery(vtkOpenGLRenderTimer *timer);
115  void EndTimeQuery(vtkOpenGLRenderTimer *timer);
116  void PrintBenchmark();
117 
118  // Cache GL state that we modify
121 
122  int Viewport[4]; // x, y, width, height
123 
124  // Used to measure execution time:
127 
128  // Parameters:
134 
137 
138  // Set to true when the shader definitions change so we know when to rebuild.
140 
143 
145 
146 private:
147  vtkOpenGLFXAAFilter(const vtkOpenGLFXAAFilter&) = delete;
148  void operator=(const vtkOpenGLFXAAFilter&) = delete;
149 };
150 
151 #endif // vtkOpenGLFXAAFilter_h
VTK_INT_MAX
#define VTK_INT_MAX
Definition: vtkType.h:161
vtkOpenGLFXAAFilter::BlendState
bool BlendState
Definition: vtkOpenGLFXAAFilter.h:119
vtkOpenGLFXAAFilter::SubpixelContrastThreshold
float SubpixelContrastThreshold
Definition: vtkOpenGLFXAAFilter.h:132
vtkOpenGLFXAAFilter::Input
vtkTextureObject * Input
Definition: vtkOpenGLFXAAFilter.h:142
vtkOpenGLFXAAFilter::DepthTestState
bool DepthTestState
Definition: vtkOpenGLFXAAFilter.h:120
vtkObject::New
static vtkObject * New()
Create an object with Debug turned off, modified time initialized to zero, and reference counting on.
vtkOpenGLFXAAFilter::QHelper
vtkOpenGLQuadHelper * QHelper
Definition: vtkOpenGLFXAAFilter.h:144
vtkObject
abstract base class for most VTK objects
Definition: vtkObject.h:59
vtkFXAAOptions
Configuration for FXAA implementations.
Definition: vtkFXAAOptions.h:30
vtkOpenGLQuadHelper
Class to make rendering a full screen quad easier.
Definition: vtkOpenGLQuadHelper.h:57
vtkOpenGLFXAAFilter::RelativeContrastThreshold
float RelativeContrastThreshold
Definition: vtkOpenGLFXAAFilter.h:129
vtkOpenGLFXAAFilter::NeedToRebuildShader
bool NeedToRebuildShader
Definition: vtkOpenGLFXAAFilter.h:139
vtkFXAAOptions::DebugOption
DebugOption
Debugging options that affect the output color buffer.
Definition: vtkFXAAOptions.h:37
vtkOpenGLRenderTimer
Asynchronously measures GPU execution time for a single event.
Definition: vtkOpenGLRenderTimer.h:37
vtkOpenGLFXAAFilter::EndpointSearchIterations
int EndpointSearchIterations
Definition: vtkOpenGLFXAAFilter.h:133
vtkOpenGLFXAAFilter::FXAATimer
vtkOpenGLRenderTimer * FXAATimer
Definition: vtkOpenGLFXAAFilter.h:126
vtkOpenGLFXAAFilter::HardContrastThreshold
float HardContrastThreshold
Definition: vtkOpenGLFXAAFilter.h:130
vtkShaderProgram
The ShaderProgram uses one or more Shader objects.
Definition: vtkShaderProgram.h:47
vtkIndent
a simple class to control print indentation
Definition: vtkIndent.h:39
vtkTextureObject
abstracts an OpenGL texture object.
Definition: vtkTextureObject.h:44
vtkOpenGLRenderer
OpenGL renderer.
Definition: vtkOpenGLRenderer.h:48
vtkOpenGLFXAAFilter
Perform FXAA antialiasing on the current framebuffer.
Definition: vtkOpenGLFXAAFilter.h:56
vtkObject::PrintSelf
void PrintSelf(ostream &os, vtkIndent indent) override
Methods invoked by print to print information about the object including superclasses.
vtkObject.h
vtkX3D::string
Definition: vtkX3D.h:490
vtkOpenGLFXAAFilter::DebugOptionValue
vtkFXAAOptions::DebugOption DebugOptionValue
Definition: vtkOpenGLFXAAFilter.h:136
vtkOpenGLFXAAFilter::Renderer
vtkOpenGLRenderer * Renderer
Definition: vtkOpenGLFXAAFilter.h:141
vtkOpenGLFXAAFilter::SubpixelBlendLimit
float SubpixelBlendLimit
Definition: vtkOpenGLFXAAFilter.h:131
vtkFXAAOptions.h
vtkOpenGLFXAAFilter::UseHighQualityEndpoints
bool UseHighQualityEndpoints
Definition: vtkOpenGLFXAAFilter.h:135
vtkOpenGLFXAAFilter::PreparationTimer
vtkOpenGLRenderTimer * PreparationTimer
Definition: vtkOpenGLFXAAFilter.h:125