diff --git a/panels/project.cpp b/panels/project.cpp index 5b5eb05e0..cb95e69a1 100644 --- a/panels/project.cpp +++ b/panels/project.cpp @@ -1246,20 +1246,22 @@ bool Project::load_worker(QFile& f, QXmlStreamReader& stream, int type) { const TransitionData& td = transition_data.at(i); Clip* primary = td.otc; Clip* secondary = td.ctc; - if (primary == NULL) { - primary = secondary; - secondary = NULL; - } - const EffectMeta* meta = get_meta_from_name(td.name, (primary->track < 0) ? EFFECT_TYPE_VIDEO : EFFECT_TYPE_AUDIO); - if (meta == NULL) { - dout << "[WARNING] Failed to link transition with name:" << td.name; - if (td.otc != NULL) td.otc->opening_transition = -1; - if (td.ctc != NULL) td.ctc->closing_transition = -1; - } else { - int transition_index = create_transition(primary, secondary, meta); - primary->sequence->transitions.at(transition_index)->set_length(td.length); - if (td.otc != NULL) td.otc->opening_transition = transition_index; - if (td.ctc != NULL) td.ctc->closing_transition = transition_index; + if (primary != NULL || secondary != NULL) { + if (primary == NULL) { + primary = secondary; + secondary = NULL; + } + const EffectMeta* meta = get_meta_from_name(td.name, (primary->track < 0) ? EFFECT_TYPE_VIDEO : EFFECT_TYPE_AUDIO); + if (meta == NULL) { + dout << "[WARNING] Failed to link transition with name:" << td.name; + if (td.otc != NULL) td.otc->opening_transition = -1; + if (td.ctc != NULL) td.ctc->closing_transition = -1; + } else { + int transition_index = create_transition(primary, secondary, meta); + primary->sequence->transitions.at(transition_index)->set_length(td.length); + if (td.otc != NULL) td.otc->opening_transition = transition_index; + if (td.ctc != NULL) td.ctc->closing_transition = transition_index; + } } } diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index eb9152270..7329f2e9a 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include @@ -37,7 +36,7 @@ extern "C" { #include } -#define GL_DEFAULT_BLEND glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); +#define GL_DEFAULT_BLEND glBlendFuncSeparate(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA, GL_SRC_ALPHA, GL_ONE); ViewerWidget::ViewerWidget(QWidget *parent) : QOpenGLWidget(parent), @@ -116,6 +115,8 @@ void ViewerWidget::retry() { } void ViewerWidget::initializeGL() { + initializeOpenGLFunctions(); + connect(context(), SIGNAL(aboutToBeDestroyed()), this, SLOT(delete_function()), Qt::DirectConnection); retry_timer.start(); @@ -347,9 +348,7 @@ void ViewerWidget::process_effect(Clip* c, Effect* e, double timecode, GLTexture if (e->enable_superimpose) { GLuint superimpose_texture = e->process_superimpose(timecode); if (superimpose_texture != 0) { - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); composite_texture = draw_clip(c->fbo[!fbo_switcher], superimpose_texture, false); - GL_DEFAULT_BLEND } } } @@ -523,6 +522,7 @@ GLuint ViewerWidget::compose_sequence(QVector& nests, bool render_audio) fbo_switcher = !fbo_switcher; + // set up default coords GLTextureCoords coords; coords.grid_size = 1; coords.vertexTopLeftX = coords.vertexBottomLeftX = -video_width/2; @@ -534,6 +534,7 @@ GLuint ViewerWidget::compose_sequence(QVector& nests, bool render_audio) coords.textureBottomLeftY = coords.textureBottomRightY = coords.textureTopRightX = coords.textureBottomRightX = 1.0; coords.textureTopLeftQ = coords.textureTopRightQ = coords.textureTopLeftQ = coords.textureBottomLeftQ = 1; + // set up autoscale if (c->autoscale && (video_width != s->width && video_height != s->height)) { float width_multiplier = (float) s->width / (float) video_width; float height_multiplier = (float) s->height / (float) video_height; diff --git a/ui/viewerwidget.h b/ui/viewerwidget.h index 38837cbaf..a6f9e3632 100644 --- a/ui/viewerwidget.h +++ b/ui/viewerwidget.h @@ -8,6 +8,7 @@ #include #include #include +#include class Viewer; struct Clip; @@ -17,7 +18,7 @@ class Effect; class EffectGizmo; struct GLTextureCoords; -class ViewerWidget : public QOpenGLWidget +class ViewerWidget : public QOpenGLWidget, QOpenGLFunctions { Q_OBJECT public: