fixed thread syncing

This commit is contained in:
itsmattkc
2019-01-17 11:49:24 +11:00
parent 0351af56a8
commit 064a0a9804
7 changed files with 21 additions and 9 deletions
+1
View File
@@ -922,6 +922,7 @@ GLuint Effect::process_superimpose(double timecode) {
}
if (valueHasChanged(timecode) || recreate_texture || enable_always_update) {
qDebug() << "redrew";
redraw(timecode);
}
+1 -1
View File
@@ -134,7 +134,7 @@ public:
Effect* copy(Clip* c);
void copy_field_keyframes(Effect *e);
virtual void load(QXmlStreamReader& stream);
virtual void load(QXmlStreamReader& stream);
virtual void custom_load(QXmlStreamReader& stream);
virtual void save(QXmlStreamWriter& stream);
+2
View File
@@ -21,4 +21,6 @@ GLuint compose_sequence(Viewer* viewer,
void compose_audio(Viewer* viewer, Sequence* seq, bool render_audio);
void viewport_render();
#endif // RENDERFUNCTIONS_H
+2 -1
View File
@@ -77,7 +77,8 @@ void RenderThread::run() {
paint();
// flush changes
glFlush();
// glFlush();
glFinish();
// release
ctx->functions()->glBindFramebuffer(GL_FRAMEBUFFER, 0);
+1 -4
View File
@@ -279,9 +279,6 @@ EffectGizmo* ViewerWidget::get_gizmo_from_mouse(int x, int y) {
break;
}
}
qDebug() << mouse_pos.x() << gizmos->gizmo(0)->screen_pos[0].x();
qDebug() << mouse_pos.y() << gizmos->gizmo(0)->screen_pos[0].y();
}
return nullptr;
}
@@ -565,7 +562,7 @@ void ViewerWidget::paintGL() {
glDisable(GL_TEXTURE_2D);
if (window != nullptr && window->isVisible()) {
window->set_texture(renderer->texColorBuffer, double(viewer->seq->width)/double(viewer->seq->height));
window->set_texture(renderer->texColorBuffer, double(viewer->seq->width)/double(viewer->seq->height), &renderer->mutex);
}
renderer->mutex.unlock();
+10 -2
View File
@@ -1,18 +1,24 @@
#include "viewerwindow.h"
#include <QMutex>
ViewerWindow::ViewerWindow(QOpenGLContext *share) :
QOpenGLWindow(share),
texture(0)
texture(0),
mutex(nullptr)
{}
void ViewerWindow::set_texture(GLuint t, double iar) {
void ViewerWindow::set_texture(GLuint t, double iar, QMutex* imutex) {
texture = t;
ar = iar;
mutex = imutex;
update();
}
void ViewerWindow::paintGL() {
if (texture > 0) {
if (mutex != nullptr) mutex->lock();
glClearColor(0.0, 0.0, 0.0, 1.0);
glClear(GL_COLOR_BUFFER_BIT);
@@ -56,5 +62,7 @@ void ViewerWindow::paintGL() {
glBindTexture(GL_TEXTURE_2D, 0);
glDisable(GL_TEXTURE_2D);
if (mutex != nullptr) mutex->unlock();
}
}
+4 -1
View File
@@ -3,15 +3,18 @@
#include <QOpenGLWindow>
class QMutex;
class ViewerWindow : public QOpenGLWindow {
Q_OBJECT
public:
ViewerWindow(QOpenGLContext* share);
void set_texture(GLuint t, double iar);
void set_texture(GLuint t, double iar, QMutex *imutex);
private:
void paintGL();
GLuint texture;
double ar;
QMutex* mutex;
};
#endif // VIEWERWINDOW_H