PDA

View Full Version : How to grab screen on thread?



Alex Snet
18th May 2009, 20:17
Hi!

I know how to grab screen in GUI thread:


QPixmap::grabWindow( QApplication::desktop()->winId() );


But how to grab the screen in another thread?
If I do it how i write before application returns this:


QPixmap: It is not safe to use pixmaps outside the GUI thread

wysota
18th May 2009, 20:21
Why would you want to do that?

Alex Snet
18th May 2009, 20:24
I wanna make a small OS screen capture utility.
If I shoots from GUI thread it stops at some time and I can't get more than 7 frames per second.

Alex Snet
18th May 2009, 20:26
Can I use OpenGL? Or it's a extra load for application?

wysota
18th May 2009, 20:50
Using another thread would only slow your application down instead of speeding it up. Making screenshots of the screen like that is a very slow operation - don't expect to get more than those few frames per second.

Alex Snet
18th May 2009, 20:55
And how I can make it faster? How I can get more than 15-20 frames per second?

wysota
18th May 2009, 21:08
Using platform dependant means. Such as XVideo on X11 (or take a look at sources of applications such as recordmydesktop).