Open evehal opened 4 months ago
@evehal Can you show a complete example of your code? I am interested in this subject (QPainter in multiple threads)
@mariuszmaximus my project too big to show,sorry mate. but qpainters in multiple thread is very common: https://doc.qt.io/qt-6/threads-modules.html and for opengl offscreen render: https://stackoverflow.com/questions/31323749/easiest-way-for-offscreen-rendering-with-qopenglwidget fbo is the key.
I can use QPainter in multiple threads like this: glBindFramebuffer(GL_FRAMEBUFFER, m_fbos[buffer_idx]); QOpenGLPaintDevice fboPaintDev(t.w,t.h); glBindTexture(GL_TEXTURE_2D, m_textures[buffer_idx]); glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA8, t.w, t.h, 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); glBindTexture(GL_TEXTURE_2D,0); m_painter.begin(&fboPaintDev); m_painter.fillRect(0, 0, t.w, t.h, QColor(0, 0, 0, 0)); m_painter.end(); glBindFramebuffer(GL_FRAMEBUFFER, 0);
how to work with qnanopainter in multiple none-ui threads?