diff --git a/dialogs/newsequencedialog.cpp b/dialogs/newsequencedialog.cpp index d40297249..ce4d12e37 100644 --- a/dialogs/newsequencedialog.cpp +++ b/dialogs/newsequencedialog.cpp @@ -112,7 +112,8 @@ void NewSequenceDialog::accept() { s->set_audio_layout(AV_CH_LAYOUT_STEREO); // FIXME: TEST CODE - new NodeMedia(s.get()); + NodeMedia* m = new NodeMedia(s.get()); + s->texture_io = m->texture_output(); // END TEST CODE ComboAction* ca = new ComboAction(); diff --git a/timeline/sequence.cpp b/timeline/sequence.cpp index 71b68e132..642fe055c 100644 --- a/timeline/sequence.cpp +++ b/timeline/sequence.cpp @@ -150,8 +150,11 @@ long Sequence::GetEndFrame() { const QObjectList& all_tracks = children(); for (int i=0;i(all_tracks.at(i)); - end_frame = qMax(t->GetEndFrame(), end_frame); + Track* t = dynamic_cast(all_tracks.at(i)); + + if (t != nullptr) { + end_frame = qMax(t->GetEndFrame(), end_frame); + } } return end_frame; @@ -165,7 +168,11 @@ QVector Sequence::GetAllClips() for (int j=0;j(tracks.at(j))->GetAllClips()); + Track* t = dynamic_cast(tracks.at(j)); + + if (t != nullptr) { + all_clips.append(t->GetAllClips()); + } } @@ -188,6 +195,11 @@ QVector Sequence::GetTrackList(olive::TrackType type) return tracks; } +GLuint Sequence::texture() +{ + return texture_io->GetValue().value(); +} + void Sequence::Close() { QVector all_clips = GetAllClips(); diff --git a/timeline/sequence.h b/timeline/sequence.h index 45b16666c..5fadbc534 100644 --- a/timeline/sequence.h +++ b/timeline/sequence.h @@ -124,6 +124,11 @@ public: int TrackCount(olive::TrackType type); QVector GetTrackList(olive::TrackType type); + // FIXME: TEST CODE + GLuint texture(); + NodeIO* texture_io; + // END TEST CODE + long playhead; bool using_workarea; diff --git a/ui/viewerwidget.cpp b/ui/viewerwidget.cpp index 4eb3d5ba1..7c247385b 100644 --- a/ui/viewerwidget.cpp +++ b/ui/viewerwidget.cpp @@ -723,6 +723,33 @@ void ViewerWidget::draw_gizmos() { } void ViewerWidget::paintGL() { + + if (viewer->seq != nullptr) { + + QOpenGLFunctions* f = context()->functions(); + + makeCurrent(); + + // clear to solid black + f->glClearColor(0.0, 0.0, 0.0, 0.0); + f->glClear(GL_COLOR_BUFFER_BIT); + + + // draw texture from render thread + + f->glViewport(0, 0, width(), height()); + + f->glBindTexture(GL_TEXTURE_2D, viewer->seq->texture()); + + qDebug() << "drawing texture" << viewer->seq->texture(); + + olive::rendering::Blit(pipeline_.get(), true, get_matrix()); + + f->glBindTexture(GL_TEXTURE_2D, 0); + + } + + /* if (waveform) { draw_waveform_func(); } else { @@ -771,4 +798,5 @@ void ViewerWidget::paintGL() { renderer.start_render(context(), viewer->seq.get(), viewer->get_playback_speed()); } } + */ }