43 #include <ACG/GL/acg_glew.hh>
45 #include "PostProcessorFXAAPlugin.hh"
48 #include <ACG/GL/GLState.hh>
49 #include <ACG/GL/gl.hh>
50 #include <ACG/GL/ScreenQuad.hh>
56 PostProcessorFXAAPlugin::PostProcessorFXAAPlugin() :
61 PostProcessorFXAAPlugin::~PostProcessorFXAAPlugin()
68 QString PostProcessorFXAAPlugin::postProcessorName() {
69 return QString(
"FXAA");
72 QString PostProcessorFXAAPlugin::checkOpenGL() {
74 return QString(
"Insufficient OpenGL Version! OpenGL 3.0 or higher required");
80 void PostProcessorFXAAPlugin::postProcess(
ACG::GLState* _glstate,
const std::vector<const PostProcessorInput*>& _input,
const PostProcessorOutput& _output) {
98 _input[0]->bindColorTex(0);
105 lumaRT_.
attachTexture2D(GL_COLOR_ATTACHMENT0, _input[0]->width, _input[0]->height, GL_RGBA, GL_RGBA, GL_CLAMP, GL_LINEAR, GL_LINEAR);
131 ACG::Vec2f texelSize(1.0f /
float(_input[0]->width), 1.0f /
float(_input[0]->height));
134 ACG::Vec4f fxaaConsoleRcp(-texelSize[0], -texelSize[1], texelSize[0], texelSize[1]);
151 #if QT_VERSION < 0x050000
static void draw(GLSL::Program *_prog=0)
Draw the screen quad.
GLSL::Program * fxaa_
fxaa shader
bool openGLVersion(const int _major, const int _minor)
void setUniform(const char *_name, GLint _value)
Set int uniform to specified value.
void attachTexture2D(GLenum _attachment, GLsizei _width, GLsizei _height, GLuint _internalFmt, GLenum _format, GLint _wrapMode=GL_CLAMP, GLint _minFilter=GL_NEAREST, GLint _magFilter=GL_NEAREST)
function to attach a texture to fbo
bool bind()
bind the fbo and sets it as rendertarget
ACG::FBO lumaRT_
fbo with rt that contains luminance in alpha
void use()
Enables the program object for using.
GLsizei width() const
get width of fbo texture
void resize(GLsizei _width, GLsizei _height, bool _forceResize=false)
resize function (if textures created by this class)
GLSL::PtrProgram loadProgram(const char *vertexShaderFile, const char *tessControlShaderFile, const char *tessEvaluationShaderFile, const char *geometryShaderFile, const char *fragmentShaderFile, const GLSL::StringList *macros, bool verbose)
GLuint getAttachment(GLenum _attachment)
return attached texture id
GLSL::Program * luma_
luma shader
void disable()
Resets to standard rendering pipeline.