fixed effects when opengl context changes
This commit is contained in:
@@ -2,7 +2,7 @@
|
||||
|
||||
#include "project/clip.h"
|
||||
|
||||
BoxBlurEffect::BoxBlurEffect(Clip *c) : Effect(c, EFFECT_TYPE_VIDEO, VIDEO_BOXBLUR_EFFECT), vert(QOpenGLShader::Vertex), frag(QOpenGLShader::Fragment) {
|
||||
BoxBlurEffect::BoxBlurEffect(Clip *c) : Effect(c, EFFECT_TYPE_VIDEO, VIDEO_BOXBLUR_EFFECT) {
|
||||
enable_opengl = true;
|
||||
|
||||
radius_val = add_row("Radius:")->add_field(EFFECT_FIELD_DOUBLE);
|
||||
@@ -19,11 +19,13 @@ BoxBlurEffect::BoxBlurEffect(Clip *c) : Effect(c, EFFECT_TYPE_VIDEO, VIDEO_BOXBL
|
||||
horiz_val->set_bool_value(true);
|
||||
vert_val->set_bool_value(true);
|
||||
|
||||
vert.compileSourceFile(":/shaders/common.vert");
|
||||
vertPath = ":/shaders/common.vert";
|
||||
fragPath = ":/shaders/boxblureffect.frag";
|
||||
/*vert.compileSourceFile(":/shaders/common.vert");
|
||||
frag.compileSourceFile(":/shaders/boxblureffect.frag");
|
||||
program.addShader(&vert);
|
||||
program.addShader(&frag);
|
||||
program.link();
|
||||
program.link();*/
|
||||
|
||||
connect(radius_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||
// connect(iteration_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||
@@ -31,15 +33,9 @@ BoxBlurEffect::BoxBlurEffect(Clip *c) : Effect(c, EFFECT_TYPE_VIDEO, VIDEO_BOXBL
|
||||
connect(vert_val, SIGNAL(changed()), this, SLOT(field_changed()));
|
||||
}
|
||||
|
||||
void BoxBlurEffect::process_gl(double timecode, GLTextureCoords &coords) {
|
||||
program.bind();
|
||||
|
||||
program.setUniformValue("resolution", parent_clip->getWidth(), parent_clip->getHeight());
|
||||
program.setUniformValue("radius", (GLfloat) radius_val->get_double_value(timecode));
|
||||
program.setUniformValue("horiz_blur", horiz_val->get_bool_value(timecode));
|
||||
program.setUniformValue("vert_blur", vert_val->get_bool_value(timecode));
|
||||
}
|
||||
|
||||
void BoxBlurEffect::clean_gl() {
|
||||
program.release();
|
||||
void BoxBlurEffect::process_gl(double timecode, GLTextureCoords&) {
|
||||
glslProgram->setUniformValue("resolution", parent_clip->getWidth(), parent_clip->getHeight());
|
||||
glslProgram->setUniformValue("radius", (GLfloat) radius_val->get_double_value(timecode));
|
||||
glslProgram->setUniformValue("horiz_blur", horiz_val->get_bool_value(timecode));
|
||||
glslProgram->setUniformValue("vert_blur", vert_val->get_bool_value(timecode));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user