View Full Version : Need fastest way to grab frame buffer
Hey guys, I need to find a fast way to get the frame buffer. Using glReadPixels is taking me down to about 3 fps (only rendering a 1 triangle scene), and that will NOT be acceptable.
First, I have constants:
- Screen will always be 512x512
- Bitdepth will always be 32bit rgba
- Platform will always be win32
Anybody have some interesting hacks? I bet there are some win32 calls I can use to make this a bit faster, but I'm not much of a win32 guy.
Machine configuration is a 550mhz P3, TNT2 AGP card.
Maybe Nvidia has an extension for this?
Oh yeah...bit more info:
Here's the exact call I'm using:
The app is windowed, and the desktop is set at 32 bits.
[This message has been edited by jmX (edited 11-10-2000).]
11-10-2000, 12:44 PM
If you're using 6.xx drivers you should be able to get MUCH faster than that. 512x512 means you are retrieving 256K pixels, and if you're at 3 fps, you're getting <1 Mpixel/sec. My own benchmarks suggest you should be able to get >10 Mpixels/sec (MINIMUM) for that kind of readback if you are using 6.xx drivers, whether you're on a TNT, TNT2, or any type of GeForce.
GL_UNSIGNED_BYTE/GL_BGRA is likely to be slightly faster than GL_UNSIGNED_BYTE/GL_RGBA, but if you're under 1 megapixel, something else is wrong.
If you're in a 16-bit mode, you'll get best results with GL_UNSIGNED_SHORT_5_6_5/GL_RGB.
11-10-2000, 12:49 PM
For reference, on my P3-700, BX, GF2 GTS, Win2K, with desktop at 32-bit, doing a 512x512 readback with type GL_UNSIGNED_BYTE and format GL_RGBA, I get 107 readbacks per second (28 Mpixels/sec). TNT2 should not be that much slower at this operation.
Ok, I just did more testing.
First, I looked at glReadPixels more carefully. It turns out that when I ask for GL_BYTE, it reads the frame buffer, converts all r, g, and b's to *FLOATS*, then converts to whatever type I specified.
I changed the call to:
and I get 4.1fps.
If I do the original:
I get 2.8fps.
Matt, using GL_BGRA_EXT gave me the same 2.8fps.
Basically, all i need is an *EXACT* copy of what is in video ram...just the 32 bit rgba framebuffer.
11-10-2000, 12:55 PM
Yes, old driver versions were slow at this on TNT2, but we optimized it. What version are you using?
Downloading the 6.31 version now. I'll let you know how it goes in a few minutes...er, make that half an hour. Seems we have a slow pipe between here and nvidia.
Ok, got the new 6.31 drivers for win2k.
Performance went from 2.8fps to 76fps. WOOHOO.
The simple solutions are always the best http://www.opengl.org/discussion_boards/ubb/smile.gif
Powered by vBulletin® Version 4.2.3 Copyright © 2017 vBulletin Solutions, Inc. All rights reserved.