PDA

View Full Version : QOpenGL in threads



wydesenej
31st March 2010, 18:39
Hi,

i am writing program with some threads and one thread painting some stream to QGLWidget.

If it runs as one thread application, painting is ok.

If it runs as multithread application (one thread for painting and others are for some control operations), painting is bad (painting starting not in the corner but at random position).

I tried lot of modifications, but it seems, that problem is threads.

I found in doc : "Please note that QGLContext is not thread safe."


Is there any possible to sovle this problem? please help.

minimoog
1st April 2010, 08:00
I don't how you render, but OpenGL is not thread safe.

saman_artorious
20th April 2013, 12:56
Is there any possible to sovle this problem? please help.
I never tried glWidget inside a thread, can you post your render n glpaint function please?
Maybe we can resolve this, despite incompatibility of opengl with threads.

saman_artorious
22nd May 2013, 13:40
Hi,
Is there any possible to sovle this problem? please help.

As far as GPU is doing all the work asynchronously, CPU threads are pointless. Therefore, your application would always be single-threaded. (at least for rendering)

wysota
22nd May 2013, 15:11
As far as GPU is doing all the work asynchronously, CPU threads are pointless. Therefore, your application would always be single-threaded. (at least for rendering)

That's not exactly true. You still have to push data into the GL pipeline using CPU.