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