Darren Taylor
05-11-2007, 03:49 AM
Hi again,
Part of my modelling program requires me to find out which vertexes are actually visible on screen, and which ones are backfacing/behind the model.
The best way I can see to do this is by running a quick scan over the back buffer, using glReadPixels to test each pixel. If a vertex is found, it's obviously drawn in front of the model and visible to the viewer.
However, I've found that using glReadPixels in this way is VERY slow. Even if I use a simple loop to read each pixel on a 640*480 window, it takes TEN seconds to complete the scan!! :eek:
I know glReadPixels has always been a slow function call, but surely it shouldn't take this long?
If so, is there another way of simply reading the color of pixels in the frame buffer? Or maybe by rendering to a texture and testing that instead - would that make it any easier?
Many thanks,
Daz.
Part of my modelling program requires me to find out which vertexes are actually visible on screen, and which ones are backfacing/behind the model.
The best way I can see to do this is by running a quick scan over the back buffer, using glReadPixels to test each pixel. If a vertex is found, it's obviously drawn in front of the model and visible to the viewer.
However, I've found that using glReadPixels in this way is VERY slow. Even if I use a simple loop to read each pixel on a 640*480 window, it takes TEN seconds to complete the scan!! :eek:
I know glReadPixels has always been a slow function call, but surely it shouldn't take this long?
If so, is there another way of simply reading the color of pixels in the frame buffer? Or maybe by rendering to a texture and testing that instead - would that make it any easier?
Many thanks,
Daz.