PDA

View Full Version : Drawing the entire window at 60 fps



antiquechrono
25th February 2010, 17:34
I have been looking around for quite a while now and have yet to find a satisfactory answer to the problem I have. I recently started using Qt and think its a great framework and want to use it in my next project.

The project requires that I be able to draw the entire window at 60 fps with pixel data created by the application. I tried using a QWidget and drawing a QImage in it with a QPainter but at 60 fps it was using a ton of CPU time. So either that method is horridly slow or I did something very wrong.

I have seen a few other methods talked about but before I go attempt any more prototypes I would like to get some opinions of people highly experienced with Qt. I was looking into opengl as a solution but have not used the api in years but I assume I would need to use textures but I don't know how efficient that would be.

To reiterate, the question is how would you redraw the entire window in Qt at 60fps with as little performance impact as possible?

Thanks for your time.

MattPhillips
25th February 2010, 21:10
How is the pixel data of one frame related to the data of the next? Is your graphics card/cpu otherwise good enough to render textures at 60 fps, e.g. in first-person shooters? Basically I see two solutions: 1) Buffering and 2) textures. I've never done anything like this with Q* objects but if you are able to create the QPixmaps etc. in advance and put them into a container then at swap time all that will remain is the drawing to the framebuffer. On the other hand, if identifiable transformations (translate, rotate, etc.) govern the relationship between one frame and the next, then you can indeed create an OpenGL and use the powerful set of tools it gives you to manipulate them on a frame by frame basis, without having to reinvent the wheel every time.

Matt