View Full Version : glReadPixel slowdown?

11-16-2006, 08:30 AM
I am using glReadPixels to capture an image and print it using a QPrinter. Before I use glReadPixels everything draws very fast. After calling glReadPixels and sending the file to the printer, all of my OpenGL paints are called twice in-a-row and now take a lot of time to occur. The print statements would fly by before printing, and after printing the exact same functionality now takes 30-60 seconds instead of the 2-5 seconds before printing. The only GL call that is made during this time is glReadPixels. I read in the Red Book that glReadPixels writes to processor memory which sounds like the L1 and L2 cache. I was wondering if I was clogging up the cache and if so how can I clean it out? Or do I understand the Red Book incorrectly in what it means by processor memory? Thanks for your help!

11-16-2006, 10:05 AM
CPU memory is main memory. glReadPixels copy the pixels to your buffer.
The problem is likely driver and hw related.

11-16-2006, 12:10 PM
Sorry I guess I should have posted I am running this on Solaris 9. I added in Qt's updateGL( ) calls before and after the glReadPixels call and the first call ran real fast and the second call ran real slow. updateGL( ) just makes the call to start all of the OpenGL painting calls I make in my program. So processor memory is considered my RAM and not the Cache? Thanks!

11-20-2006, 09:38 AM
It appears that when I open a secondary Qt window that my subsequent calls to glReadPixels( ) and glBitmap( ) cause the repaints to occur very slowly. I don't know how to fix this as I have tried many things. If anyone else has any other ideas it would be great. Thanks!