plug export into render thread
This commit is contained in:
+10
-1
@@ -125,12 +125,19 @@ void RenderThread::paint() {
|
||||
}
|
||||
}
|
||||
|
||||
if (pixel_buffer != nullptr) {
|
||||
ctx->functions()->glBindFramebuffer(GL_READ_FRAMEBUFFER, frameBuffer);
|
||||
glReadPixels(0, 0, tex_width, tex_height, GL_RGBA, GL_UNSIGNED_BYTE, pixel_buffer);
|
||||
ctx->functions()->glBindFramebuffer(GL_READ_FRAMEBUFFER, 0);
|
||||
pixel_buffer = nullptr;
|
||||
}
|
||||
|
||||
glDisable(GL_DEPTH);
|
||||
glDisable(GL_BLEND);
|
||||
glDisable(GL_TEXTURE_2D);
|
||||
}
|
||||
|
||||
void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QString& save, int idivider) {
|
||||
void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QString& save, GLvoid* pixels, int idivider) {
|
||||
seq = s;
|
||||
|
||||
// stall any dependent actions
|
||||
@@ -147,6 +154,8 @@ void RenderThread::start_render(QOpenGLContext *share, Sequence *s, const QStrin
|
||||
}
|
||||
|
||||
save_fn = save;
|
||||
pixel_buffer = pixels;
|
||||
|
||||
queued = true;
|
||||
waitCond.wakeAll();
|
||||
}
|
||||
|
||||
+2
-1
@@ -20,7 +20,7 @@ public:
|
||||
GLuint frameBuffer;
|
||||
GLuint texColorBuffer;
|
||||
void paint();
|
||||
void start_render(QOpenGLContext* share, Sequence* s, const QString &save = nullptr, int idivider = 0);
|
||||
void start_render(QOpenGLContext* share, Sequence* s, const QString &save = nullptr, GLvoid *pixels = nullptr, int idivider = 0);
|
||||
bool did_texture_fail();
|
||||
void cancel();
|
||||
signals:
|
||||
@@ -43,6 +43,7 @@ private:
|
||||
bool texture_failed;
|
||||
bool running;
|
||||
QString save_fn;
|
||||
GLvoid *pixel_buffer;
|
||||
};
|
||||
|
||||
#endif // RENDERTHREAD_H
|
||||
|
||||
@@ -229,6 +229,10 @@ void ViewerWidget::frame_update() {
|
||||
}
|
||||
}
|
||||
|
||||
RenderThread *ViewerWidget::get_renderer() {
|
||||
return renderer;
|
||||
}
|
||||
|
||||
//void ViewerWidget::resizeGL(int w, int h)
|
||||
//{
|
||||
//}
|
||||
|
||||
@@ -44,6 +44,7 @@ public:
|
||||
bool force_quit;
|
||||
|
||||
void frame_update();
|
||||
RenderThread* get_renderer();
|
||||
public slots:
|
||||
void set_waveform_scroll(int s);
|
||||
protected:
|
||||
|
||||
Reference in New Issue
Block a user